示例#1
0
        public void TestUpdate(AuthorViewModel model, string name, string test, string result)
        {
            _init();
            AuthorController controler = new AuthorController(_service);

            controler.New(model).GetAwaiter().GetResult();
            var r      = controler.Vizualise(1) as PartialViewResult;
            var _model = (r.Model as AuthorViewModel);

            _model.Name = name;
            controler.Update(_model).GetAwaiter().GetResult();
            r      = controler.Vizualise(1) as PartialViewResult;
            _model = (r.Model as AuthorViewModel);
            Assert.IsTrue(_model.Name == result, $"Erro no Teste: {test}");
        }
示例#2
0
        public void TestView(AuthorViewModel model, string test)
        {
            _init();
            AuthorController controler = new AuthorController(_service);

            controler.New(model).GetAwaiter().GetResult();
            var r = controler.Vizualise(1) as PartialViewResult;

            Assert.IsTrue((r.Model as AuthorViewModel) != null, $"Erro no Teste: {test}");
        }
示例#3
0
        public void TestDelete(AuthorViewModel model, int id, string test)
        {
            _init();
            AuthorController controler = new AuthorController(_service);

            controler.New(model).GetAwaiter().GetResult();
            controler.Delete(id).GetAwaiter().GetResult();
            try
            {
                var r = controler.Vizualise(1) as PartialViewResult;
                Assert.Fail($"Erro no Teste: {test}");
            }
            catch (Exception)
            {
                Assert.Pass();
            }
        }