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

            Assert.IsInstanceOf(typeof(ViewResult), index);
        }
예제 #2
0
        public void GetJsonTest()
        {
            using (var db = new db_context())
            {
                var ctrl = new NieruchmoscController();
                int id   = db.Osoby.First().ID;
                var json = ctrl.GetNieruchomosci(id);

                Assert.IsInstanceOf(typeof(JsonResult), json);
            }
        }
예제 #3
0
        public void AddGetTest()
        {
            using (var db = new db_context())
            {
                int id   = db.Osoby.First().ID;
                var ctrl = new NieruchmoscController();
                var add  = ctrl.Add(id);                      //add Nie pobiera lczby argumentów

                Assert.IsInstanceOf(typeof(ViewResult), add);
            }
        }
예제 #4
0
        public void MapPartialTest()
        {
            using (var db = new db_context())
            {
                var ctrl         = new NieruchmoscController();
                int ID           = 0;
                var nieruchomosc = db.Nieruchomosci.FirstOrDefault(x => x.ID == ID);
                var map          = ctrl.MapPartial(ID);

                Assert.IsInstanceOf(typeof(PartialViewResult), map);
            }
        }
예제 #5
0
        public void AddPostTest()
        {
            using (var db = new db_context())
            {
                Nieruchomosc model = new Nieruchomosc
                {
                    IDOsoby = 1,
                    Nazwa   = "Dom",
                    Adres   = "Orkana 27",
                    lat     = 21.00000,
                    lng     = 52.06543
                };
                var ctrl = new NieruchmoscController();
                var add  = ctrl.Add(model);

                bool exist = db.Nieruchomosci.Any(x => x.IDOsoby == model.IDOsoby && x.Nazwa == model.Nazwa && x.Adres == model.Adres &&
                                                  x.lat == model.lat && x.lng == model.lng);
                Assert.IsTrue(exist);
            }
        }