diff --git a/src/Squire/ControlStructureKihon.cs b/src/Squire/ControlStructureKihon.cs new file mode 100644 index 0000000..ed6ffc6 --- /dev/null +++ b/src/Squire/ControlStructureKihon.cs @@ -0,0 +1,37 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Squire.Framework; +using System.Collections.Generic; + +namespace Squire +{ + [TestClass] + public class ControlStructureKihon : ControlStructuresKihonStructure + { + + protected override void Call_Hit_On_a_If_val_Is_True_Else_Call_Hit_On_b(bool val, ITarget a, ITarget b) + { + throw new NotImplementedException(); + } + + protected override void Call_Hit_On_a_Once_For_Each_Member_Of_list(ITarget a, List list) + { + throw new NotImplementedException(); + } + + protected override void Call_Hit_On_a_While_a_IsValid_Is_True(ITarget a) + { + throw new NotImplementedException(); + } + + protected override void n_Times_Call_Hit_On_a(int n, ITarget a) + { + throw new NotImplementedException(); + } + + protected override void Call_Hit_On_a_Once_And_Continue_Until_IsValid_Is_False(ITarget a) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Squire/Framework/ControlStructuresKihonStructure.cs b/src/Squire/Framework/ControlStructuresKihonStructure.cs index 7b151d2..1734dfd 100644 --- a/src/Squire/Framework/ControlStructuresKihonStructure.cs +++ b/src/Squire/Framework/ControlStructuresKihonStructure.cs @@ -60,8 +60,55 @@ public void Call_Hit_On_a_Once_For_Each_Member_Of_list() a.AssertWasCalled(m => m.Hit(), mo => mo.Repeat.Times(4)); } + [TestMethod] + public void Call_Hit_On_a_While_a_IsValid_Is_True() + { + // Arrange + var a = MockRepository.GenerateMock(); + a.Stub(m => m.IsValid).Return(true).Repeat.Times(4); + a.Stub(m => m.IsValid).Return(false).Repeat.Times(1); + + // Act + Call_Hit_On_a_While_a_IsValid_Is_True(a); + + // Assert + a.AssertWasCalled(m => m.Hit(), mo => mo.Repeat.Times(4)); + } + + [TestMethod] + public void n_Times_Call_Hit_On_a() + { + // Arrange + var a = MockRepository.GenerateMock(); + var n = 132; + + // Act + n_Times_Call_Hit_On_a(n, a); + + // Assert + a.AssertWasCalled(m => m.Hit(), mo => mo.Repeat.Times(n)); + } + + [TestMethod] + public void Call_Hit_On_a_Once_And_Continue_Until_IsValid_Is_False() + { + // Arrange + var a = MockRepository.GenerateMock(); + a.Stub(m => m.IsValid).Return(true).Repeat.Times(4); + a.Stub(m => m.IsValid).Return(false).Repeat.Times(1); + + // Act + Call_Hit_On_a_Once_And_Continue_Until_IsValid_Is_False(a); + + // Assert + a.AssertWasCalled(m => m.Hit(), mo => mo.Repeat.Times(5)); + } + protected abstract void Call_Hit_On_a_If_val_Is_True_Else_Call_Hit_On_b(bool val, ITarget a, ITarget b); protected abstract void Call_Hit_On_a_Once_For_Each_Member_Of_list(ITarget a, List list); + protected abstract void Call_Hit_On_a_While_a_IsValid_Is_True(ITarget a); + protected abstract void n_Times_Call_Hit_On_a(int n, ITarget a); + protected abstract void Call_Hit_On_a_Once_And_Continue_Until_IsValid_Is_False(ITarget a); } } diff --git a/src/Squire/Squire.csproj b/src/Squire/Squire.csproj index 379d3b9..7da0fda 100644 --- a/src/Squire/Squire.csproj +++ b/src/Squire/Squire.csproj @@ -55,6 +55,7 @@ +