public void ShouldAllowVerifyingSettingPropertyInSequence() { var something = "something"; var sequence = new CallSequence(); var mock1 = new Mock<RoleWithProperty> { CallSequence = sequence }; mock1.Object.Anything = something; mock1.Object.Anything = something + something; sequence.Verify( mock1.CallToSet(m => m.Anything = something), mock1.CallToSet(m => m.Anything = something + something) ); }
public void ShouldThrowExceptionWhenOrderVerificationIsPerformedForSettingProperty() { var something = "something"; var mock1 = new Mock<RoleWithProperty>(); mock1.Object.Anything = something; Assert.Throws<NoSequenceAssignedException>(() => mock1.CallSequence.Verify(mock1.CallToSet(m => m.Anything = something)) ); }
public void ShouldThrowExceptionWhenVerifiedPropertySetDoNotMatchActual() { var something = "something"; var sequence = new CallSequence(); var mock1 = new Mock<RoleWithProperty> { CallSequence = sequence }; mock1.Object.Anything = something; mock1.Object.Anything = something + something; Assert.Throws<MockException>( () => sequence.Verify( mock1.CallToSet(m => m.Anything = something + something), mock1.CallToSet(m => m.Anything = something) ) ); }