コード例 #1
0
        public void PropertySupport_ArrangeGetterReturnValue_IsVerified()
        {
            var mockContext = new MockContext <IProp>();
            var propMock    = new PropMock(mockContext);

            mockContext.Arrange(x => x.ReadOnlyProperty).Returns(() => "result");

            var propertyValue = propMock.ReadOnlyProperty;

            Assert.Equal("result", propertyValue);
        }
コード例 #2
0
        public void PropertySupport_ArrangeGetterAndSetter_IsVerified()
        {
            var mockContext = new MockContext <IProp>();
            var propMock    = new PropMock(mockContext);

            mockContext.ArrangeProperty(x => x.TwoWayProperty);

            var propertyValue = propMock.TwoWayProperty;

            Assert.Null(propertyValue);

            propMock.TwoWayProperty = "customValue";

            propertyValue = propMock.TwoWayProperty;
            Assert.Equal("customValue", propertyValue);
        }