예제 #1
0
        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);
        }
예제 #2
0
        public void ReturnDefaultIfNoStepInLenientModeOnGetting()
        {
            var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            int result       = propertyMock.Value;

            Assert.Equal(0, result);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
 }
예제 #7
0
        public void DoNothingIfNoStepInLenientModeOnSetting()
        {
            var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);

            propertyMock.Value = 5;
        }