Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public void ReturnDefaultIfClearedInLenientModeOnGetting()
        {
            var propertyMock = new PropertyMock <int>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient);
            var nextStep     = NextStepFor(propertyMock, 5);

            propertyMock.Clear();
            int result = propertyMock.Value;

            Assert.Equal(0, nextStep.GetCount);
            Assert.Equal(0, nextStep.SetCount);
            Assert.Equal(0, result);
        }