Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
 }
Esempio n. 7
0
        public void DoNothingIfNoStepInLenientModeOnSetting()
        {
            var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);

            propertyMock.Value = 5;
        }