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

            propertyMock.Value = 5;
        }