Exemple #1
0
        public void All_Should_Return_No_Items()
        {
            ReservationRepository reservationRepository = new ReservationRepository();

            int expectedResult = 0;
            int actualResult   = reservationRepository.All().Count();

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemple #2
0
        public void All_Should_Return_3_Items()
        {
            ReservationRepository reservationRepository = new ReservationRepository();
            Reservation           reservation           = new Reservation
            {
                Firstnanme      = "John",
                Lastname        = "Smith",
                DepartureDate   = new DateTime(2017, 11, 1),
                ReturnDate      = new DateTime(2017, 11, 14),
                DepatureCity    = "London",
                DestinationCity = "New York"
            };

            reservationRepository.Save(reservation);

            reservation = new Reservation
            {
                Firstnanme      = "James",
                Lastname        = "Bond",
                DepartureDate   = new DateTime(2017, 11, 7),
                ReturnDate      = new DateTime(2017, 11, 21),
                DepatureCity    = "London",
                DestinationCity = "Paris"
            };
            reservationRepository.Save(reservation);

            reservation = new Reservation
            {
                Firstnanme      = "Jane",
                Lastname        = "Doe",
                DepartureDate   = new DateTime(2017, 12, 1),
                ReturnDate      = new DateTime(2017, 12, 8),
                DepatureCity    = "Manchester",
                DestinationCity = "Rome"
            };
            reservationRepository.Save(reservation);

            int expectedResult = 3;
            int actualResult   = reservationRepository.All().Count();

            Assert.AreEqual(expectedResult, actualResult);
        }
Exemple #3
0
        public void Delete_Should_Delete_Reservation_With_Id_1()
        {
            ReservationRepository reservationRepository = new ReservationRepository();

            Reservation reservation = new Reservation
            {
                Firstnanme      = "John",
                Lastname        = "Smith",
                DepartureDate   = new DateTime(2017, 11, 1),
                ReturnDate      = new DateTime(2017, 11, 14),
                DepatureCity    = "London",
                DestinationCity = "New York"
            };

            reservationRepository.Save(reservation);

            reservationRepository.Delete(1);

            int expectedResult = 0;
            int actualResult   = reservationRepository.All().Count();

            Assert.AreEqual(expectedResult, actualResult);
        }