예제 #1
0
        public void IndexTest()
        {
            var ctrl  = new OsobyController();
            var index = ctrl.Index(null);

            Assert.IsInstanceOf(typeof(ViewResult), index);
        }
예제 #2
0
        public void AddGetTest()
        {
            using (var db = new db_context())
            {
                var ctrl = new OsobyController();
                var add  = ctrl.Add();

                Assert.IsInstanceOf(typeof(ViewResult), add);
            }
        }
예제 #3
0
        public void EditGetTest()
        {
            using (var db = new db_context())
            {
                int id   = db.Osoby.First().ID;
                var ctrl = new OsobyController();
                var edit = ctrl.Edit(id);

                Assert.IsInstanceOf(typeof(ViewResult), edit);
            }
        }
예제 #4
0
        public void RemoveTypeTest()
        {
            using (var db = new db_context())
            {
                var model  = db.Osoby.First();
                var ctrl   = new OsobyController();
                var remove = ctrl.Remove(model);

                Assert.IsInstanceOf(typeof(ActionResult), remove);
            }
        }
예제 #5
0
        public void EditPostTypeTest()
        {
            using (var db = new db_context())
            {
                Osoba model = db.Osoby.First();
                model.Imie     = "Zacheusz";
                model.Nazwisko = "Olek";
                model.Wiek     = 99;
                var ctrl = new OsobyController();
                var edit = ctrl.Edit(model);

                Assert.IsInstanceOf(typeof(ActionResult), edit);
            }
        }
예제 #6
0
        public void AddPostTypeTest()
        {
            using (var db = new db_context())
            {
                Osoba model = new Osoba();
                model.Imie     = "Zbyszek";
                model.Nazwisko = "Erbal";
                model.Wiek     = 94;
                var ctrl = new OsobyController();
                var add  = ctrl.Add(model);

                Assert.IsInstanceOf(typeof(ActionResult), add);
            }
        }
예제 #7
0
        public void EditPostTest()
        {
            using (var db = new db_context())
            {
                Osoba model = db.Osoby.First();
                model.Imie     = "Zacheusz";
                model.Nazwisko = "Olek";
                model.Wiek     = 99;
                var ctrl = new OsobyController();
                var edit = ctrl.Edit(model);

                var modelUpdated = db.Osoby.First(x => x.ID == model.ID);
                Assert.IsTrue(modelUpdated.Imie == model.Imie && modelUpdated.Nazwisko == model.Nazwisko && modelUpdated.Wiek == model.Wiek);
            }
        }
예제 #8
0
        public void AddPostTest()
        {
            using (var db = new db_context())
            {
                Osoba model = new Osoba();
                model.Imie     = "Zbyszek";
                model.Nazwisko = "Erbal";
                model.Wiek     = 94;
                var ctrl = new OsobyController();
                var add  = ctrl.Add(model);

                bool exist = db.Osoby.Any(x => x.Imie == model.Imie && x.Nazwisko == model.Nazwisko && x.Wiek == model.Wiek);
                Assert.IsTrue(exist);
            }
        }