Esempio n. 1
0
        public void DisplaySnakes()//List All Snakes //WORKS--NO WORK NEEDED
        {
            view.WorkFlowHeader("Display Snakes");

            view.GeneralWriteLine("Here are the snakes currently in our system");
            List <Snake> snakesToDisplay = repo.ReadAll();

            foreach (var snake in snakesToDisplay)
            {
                view.DisplaySnake(snake);
            }

            view.GeneralWriteLine("Press any key to continue.");
            Console.ReadKey();
        }
Esempio n. 2
0
        public void CanAddSnakeTest()
        {
            SMRepository repo = new SMRepository();

            Snake newSnake = new Snake();

            newSnake.ID                  = 1;
            newSnake.Family              = SnakeFamily.Boidae;
            newSnake.CommonSpeciesName   = "Dr. Phil";
            newSnake.LengthInCentimeters = 35M;
            newSnake.Venomous            = false;

            repo.Create(newSnake);

            List <Snake> snakes = repo.ReadAll();

            Assert.AreEqual(1, snakes.Count());
        }
Esempio n. 3
0
        public void CanDeleteSnakeTest()
        {
            SMRepository repo = new SMRepository();

            Snake newSnake = new Snake();

            newSnake.ID                  = 3;
            newSnake.Family              = SnakeFamily.Viperidae;
            newSnake.CommonSpeciesName   = "James";
            newSnake.LengthInCentimeters = 35M;
            newSnake.Venomous            = true;

            Snake third = repo.Create(newSnake);

            List <Snake> snakes = repo.ReadAll();

            Assert.AreEqual(1, snakes.Count());
            repo.Delete(3);
            Assert.AreEqual(0, snakes.Count());
        }
Esempio n. 4
0
        public void CanReadByIDTest()
        {
            SMRepository repo = new SMRepository();

            Snake newSnake = new Snake();

            newSnake.ID                  = 2;
            newSnake.Family              = SnakeFamily.Boidae;
            newSnake.CommonSpeciesName   = "Gandhi";
            newSnake.LengthInCentimeters = 190M;
            newSnake.Venomous            = false;

            repo.Create(newSnake);

            List <Snake> snakes      = repo.ReadAll();
            Snake        snakeToRead = repo.ReadByID(2);

            Assert.AreEqual(2, snakeToRead.ID);
            Assert.AreEqual(SnakeFamily.Boidae, snakeToRead.Family);
            Assert.AreEqual("Gandhi", snakeToRead.CommonSpeciesName);
            Assert.AreEqual(190, snakeToRead.LengthInCentimeters);
            Assert.AreEqual(false, snakeToRead.Venomous);
        }