public void ShouldAllowVerifyingGettingPropertyInSequence() { var sequence = new CallSequence(); string something; var mock1 = new Mock<RoleWithProperty> { CallSequence = sequence }; something = mock1.Object.Anything; something = mock1.Object.AnythingElse; sequence.Verify( mock1.CallToGet(m => m.Anything), mock1.CallToGet(m => m.AnythingElse)); sequence.Verify( mock1.CallToGet(m => m.Anything), mock1.CallToGet(m => m.AnythingElse)); }
public void ShouldThrowExceptionWhenOrderVerificationIsPerformedForGettingProperty() { var mock1 = new Mock<RoleWithProperty>(); var anything = mock1.Object.Anything; Assert.Throws<NoSequenceAssignedException>( () => mock1.CallSequence.Verify(mock1.CallToGet(m => m.Anything)) ); }
public void ShouldThrowExceptionWhenVerifiedPropertyGetDoNotMatchActual() { string something; var sequence = new CallSequence(); var mock1 = new Mock<RoleWithProperty> { CallSequence = sequence }; something = mock1.Object.Anything; something = mock1.Object.AnythingElse; Assert.Throws<MockException>( () => sequence.Verify( mock1.CallToGet(m => m.AnythingElse), mock1.CallToGet(m => m.Anything) ) ); }