예제 #1
0
        public void AttributeBypassesNonBlogViewModels()
        {
            var simpleModel = new SimpleModel();
            var context = CreateContext(simpleModel);

            var attribute = new BlogModelAttribute(null);

            attribute.OnResultExecuting(context);

            Assert.That(simpleModel, Is.Not.TypeOf<BlogViewModel>());
        }
예제 #2
0
        public void AttributeAddsBlogInfoToBlogViewModel()
        {
            var model = new DummyBlogModel();
            var context = CreateContext(model);
            var expectedInfo = new BlogInfo();
            var provider = Mock.Of<IBlogInfoProvider>(f => f.GetBlogInfo() == expectedInfo);

            var attribute = new BlogModelAttribute(provider);

            attribute.OnResultExecuting(context);

            Assert.That(model.BlogInfo, Is.EqualTo(expectedInfo));
        }