Ejemplo n.º 1
0
        public void new_should_return_app_model()
        {
            //act
            var sut = new AppControllerBuilder().Build();

            var view = sut.New();

            //assert
            Assert.NotNull(view);
            sut.AssertGetAttribute(ActionNameNew);
        }
Ejemplo n.º 2
0
        public void new_should_return_app_model_if_model_is_invalid()
        {
            //arrange
            var appService   = new Mock <IAppService>();
            var inValidModel = new AppModel {
                Name = "test name", Url = "test.com"
            };

            //act

            var sut = new AppControllerBuilder().WithAppService(appService.Object)
                      .Build();

            var view = sut.New(inValidModel).Result as ViewResult;

            //assert
            Assert.NotNull(view);
            Assert.NotNull(view.Model);
            var model = view.Model as AppModel;

            Assert.NotNull(model);

            sut.AssertPostAndAntiForgeryTokenAttribute(ActionNameNew, new[] { typeof(AppModel) });
        }