public void RemoveForwardsToNextStep() { var vg = new VerificationGroup(); EventStep.ExpectedUsage(vg, null, expectedNumberOfAdds: 0, expectedNumberOfRemoves: 1); EventStep.Remove(MockInfo.Lenient, _eventHandler); vg.Assert(); }
public void SetForwardsToNextStep() { var vg = new VerificationGroup(); PropertyStep.ExpectedUsage(vg, null, expectedNumberOfGets: 0, expectedNumberOfSets: 1); PropertyStep.Set(MockInfo.Lenient, 1); vg.Assert(); }
public void CallForwardsToNextStep() { var vg = new VerificationGroup(); MethodStep.ExpectedUsage(vg, null, expectedNumberOfCalls: 1); MethodStep.Call(MockInfo.Lenient, 1); vg.Assert(); }
public void UseElseBranchIfAskedInNoParameterCase() { var vg = new VerificationGroup(); MockMembers.SimpleFunc .InstanceIf(inst => true, s => s.ExpectedUsage(vg, "IfBranch", 1).Join(s.ElseBranch)) .ExpectedUsage(vg, "ElseBranch", 1); Sut.SimpleFunc(); vg.Assert(); }
public void UseElseBranchIfAsked() { var vg = new VerificationGroup(); MockMembers.FuncWithParameter .InstanceIf((inst, i) => true, s => s.ExpectedUsage(vg, "IfBranch", 1).Join(s.ElseBranch)) .ExpectedUsage(vg, "ElseBranch", 1); Sut.FuncWithParameter(42); vg.Assert(); }
public void CallBaseIfConditionsAreNotMet() { var group = new VerificationGroup(); MockMembers.SimpleAction .InstanceIf(i => false, b => b.ExpectedUsage(group, null, 0)) .ExpectedUsage(group, null, 1); Sut.SimpleAction(); group.Assert(); }
public void CallBaseIfConditionsAreNotMet() { var group = new VerificationGroup(); MockMembers.MyEvent .InstanceIf((i, h) => false, (i, h) => false, b => b.ExpectedUsage(group, null, 0, 0)) .ExpectedUsage(group, null, 1, 1); Sut.MyEvent += MyFirstEventHandler; Sut.MyEvent -= MyFirstEventHandler; group.Assert(); }
public void UseElseBranchIfAsked() { var vg = new VerificationGroup(); MockMembers.StringProperty .If(() => true, v => true, s => s.ExpectedUsage(vg, "IfBranch", 1, 1).Join(s.ElseBranch)) .ExpectedUsage(vg, "ElseBranch", 1, 1); Sut.StringProperty = "one"; var _ = Sut.StringProperty; vg.Assert(); }
public void CheckConditionInNoReturnValueCase() { var group = new VerificationGroup(); MockMembers.ActionWithParameter .If(a => a > 5, s => s.ExpectedUsage(group, null, 1)) .ExpectedUsage(group, null, 2); Sut.ActionWithParameter(1); Sut.ActionWithParameter(6); Sut.ActionWithParameter(-3); group.Assert(); }
public void CheckConditionInNoParameterOrReturnValueCase() { bool flag = false; var group = new VerificationGroup(); MockMembers.SimpleAction // ReSharper disable once AccessToModifiedClosure .If(() => flag, s => s.ExpectedUsage(group, null, 1)) .ExpectedUsage(group, null, 2); Sut.SimpleAction(); Sut.SimpleAction(); flag = true; Sut.SimpleAction(); group.Assert(); }