Beispiel #1
0
        public void CreateSnake()//Create Snake
        {
            view.WorkFlowHeader("Create/Add Snake");
            Snake snakeToCreate = view.GetNewSnakeInfo();//Returns a snake object, set to snakeToCreate

            Console.Clear();

            repo.Create(snakeToCreate);
            view.DisplaySnake(snakeToCreate);
            Console.WriteLine();//Question is, did it add to _snakeList??? A feeling it did not
            view.GeneralWriteLine("Your snake has been added to the system.");
            Console.ReadKey();
        }
Beispiel #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());
        }
Beispiel #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());
        }
Beispiel #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);
        }