コード例 #1
0
        public void BindModelReturnsCorrectResult(DateViewModelBinder sut,
            ControllerContext controllerContext,
            ModelBindingContext bindingContext,
            DateTime dateTime,
            CultureInfo culture)
        {
            var rawValue = dateTime.ToString(DateViewModelBinder.DateFormat);
            Mock.Get(bindingContext.ValueProvider)
                .Setup(vp => vp.GetValue("id"))
                .Returns(new ValueProviderResult(rawValue, rawValue, culture));

            var actual = sut.BindModel(controllerContext, bindingContext);

            var model = Assert.IsAssignableFrom<DateViewModel>(actual);
            dateTime.AsSource().OfLikeness<DateViewModel>().ShouldEqual(model);
        }
コード例 #2
0
 public void SutIsModelBinder(DateViewModelBinder sut)
 {
     Assert.IsAssignableFrom<IModelBinder>(sut);
 }