public void ThrowIfNoStepInVeryStrictModeOnGetting() { var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.VeryStrict); var ex = Assert.Throws <MockMissingException>(() => propertyMock.Value); Assert.Equal(MockType.PropertyGet, ex.MemberType); }
public void ReturnDefaultIfNoStepInLenientModeOnGetting() { var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); int result = propertyMock.Value; Assert.Equal(0, result); }
public void DoNothingIfClearedInLenientModeOnSetting() { var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); var nextStep = NextStepFor(propertyMock, 5); propertyMock.Clear(); propertyMock.Value = 5; Assert.Equal(0, nextStep.GetCount); Assert.Equal(0, nextStep.SetCount); }
public void ThrowIfClearedInVeryStrictModeOnGetting() { var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.VeryStrict); var nextStep = NextStepFor(propertyMock, 5); propertyMock.Clear(); var ex = Assert.Throws <MockMissingException>(() => propertyMock.Value); Assert.Equal(MockType.PropertyGet, ex.MemberType); Assert.Equal(0, nextStep.GetCount); Assert.Equal(0, nextStep.SetCount); }
public void SendMockInformationToStepAndGetValueOnGetting() { var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); var nextStep = NextStepFor(propertyMock, 5); int value = propertyMock.Value; Assert.Equal(1, nextStep.GetCount); Assert.Equal(0, nextStep.SetCount); Assert.Same(propertyMock, nextStep.LastGetMockInfo); Assert.Equal(5, value); }
public PropertyMockSetNextStepTests() { _propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); }
public void DoNothingIfNoStepInLenientModeOnSetting() { var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); propertyMock.Value = 5; }