コード例 #1
0
        public void OnlyAppliesToType_IFubuRequest()
        {
            var binder = new FubuRequestPropertyBinder();
            var model = new FubuRequestModel();

            binder.Matches(model.GetType().GetProperty("Request")).ShouldBeTrue();
            binder.Matches(model.GetType().GetProperty("NotRequest")).ShouldBeFalse();
        }
コード例 #2
0
        public void SetsPropertyFromContextOnModel()
        {
            var binder = new FubuRequestPropertyBinder();
            var model = new FubuRequestModel();
            var context = new Mock<IBindingContext>();
            var fubuRequest = new FubuRequest(null, null);

            context.Setup(x => x.Service<IFubuRequest>()).Returns(fubuRequest);
            context.SetupGet(x => x.Object).Returns(model);

            binder.Bind(model.GetType().GetProperty("Request"), context.Object);

            model.Request.ShouldEqual(fubuRequest);
        }