Пример #1
0
        public ActionResult Create(string name, int difficulty, int summits, bool waterfalls, bool streams, bool mountainViews, bool meadows, bool lakes, string location, int id)
        {
            Trail newTrail = new Trail(name, difficulty, summits, waterfalls, streams, mountainViews, meadows, lakes, location);

            newTrail.Save();
            Trail.GetAll();
            return(View("Show", newTrail));
        }
Пример #2
0
        public void Save_DatabaseAssignsIdToTrail_Id()
        {
            Trail testTrail = new Trail("TrailName1", 1, 2.5f, 3, true, true, true, true, true, true);

            testTrail.Save();
            Trail savedTrail = Trail.GetAll()[0];
            int   result     = savedTrail.GetId();
            int   testId     = testTrail.GetId();

            Assert.AreEqual(testId, result);
        }
Пример #3
0
        public void GetAll_ReturnsAllTrails_TrailList()
        {
            Trail testTrail1 = new Trail("TrailName1", 1, 2.5f, 3, true, true, true, true, true, true);
            Trail testTrail2 = new Trail("TrailName1", 1, 2.5f, 3, true, true, true, true, true, true);

            testTrail1.Save();
            testTrail2.Save();
            List <Trail> result  = Trail.GetAll();
            List <Trail> newList = new List <Trail> {
                testTrail1, testTrail2
            };

            CollectionAssert.AreEqual(result, newList);
        }
Пример #4
0
        public void Save_SavesTrailToDatabase_TrailList()
        {
            List <Trail> testList1  = new List <Trail>();
            Trail        testTrail1 = new Trail("TrailName1", 1, 2.5f, 3, true, true, true, true, true, true);

            testTrail1.Save();
            testList1.Add(testTrail1);
            Trail testTrail2 = new Trail("TrailName1", 1, 2.5f, 3, true, true, true, true, true, true);

            testTrail2.Save();
            testList1.Add(testTrail2);
            List <Trail> testList2 = Trail.GetAll();

            CollectionAssert.AreEqual(testList1, testList2);
        }
Пример #5
0
        public void GetAll_TrailsStartEmpty_TrailList()
        {
            int result = Trail.GetAll().Count;

            Assert.AreEqual(0, result);
        }