コード例 #1
0
        public void ReserveThreeSeatsIocPattern()
        {
            this.seats = new Collection <Seat>
            {
                new Seat()
                {
                    Column = 12, Row = 4
                },
                new Seat()
                {
                    Column = 13, Row = 4
                },
                new Seat()
                {
                    Column = 14, Row = 4
                }
            };

            Reserve reserve = new Reserve(this.seats)
            {
                Film     = "El Violinista del diablo",
                Function = "2020-03-02 20:00"
            };

            EliteMovieEntryPoint eliteMovie = new EliteMovieEntryPoint();

            eliteMovie.Reserve(reserve);

            IEliteMovieValidator validator = ContainerFactory.Get <IEliteMovieValidator>();

            validator.Reserve = reserve;
            validator.VerifiesReserveSeats();
        }
コード例 #2
0
        public void ReserveThreeSeats()
        {
            this.driver.Navigate().GoToUrl(this.uri);

            Reserve reserve = new Reserve("El Violinista del Diablo", "2");

            reserve.Seats.Add(new Seat(4, 12));
            reserve.Seats.Add(new Seat(4, 13));
            reserve.Seats.Add(new Seat(4, 14));

            EliteMovieEntryPoint eliteMovie = new EliteMovieEntryPoint();

            eliteMovie.Reserve(reserve);

            List <Seat> bookedSeats = new List <Seat>();

            using (WebClient request = new WebClient())
            {
                string   response = request.DownloadString("http://localhost:8080/rest/showtime/2");
                Showtime showTime = JsonConvert.DeserializeObject <Showtime>(response);

                showTime.Seats.ForEach(block => bookedSeats.AddRange(block.Where(seat => seat.Booked)));
            }

            CollectionAssert.AreEquivalent(reserve.Seats, bookedSeats);
        }
コード例 #3
0
        public void ReserveThreeSeatsFluentPattern()
        {
            Collection <Seat> seats = new Collection <Seat>
            {
                new Seat()
                {
                    Column = 12, Row = 4
                },
                new Seat()
                {
                    Column = 13, Row = 4
                },
                new Seat()
                {
                    Column = 14, Row = 4
                }
            };

            Reserve reserve = new Reserve(seats)
            {
                Film     = "El Violinista del diablo",
                Function = "2020-03-02 20:00"
            };

            Uri uri = new Uri(this.url);

            Driver.Instance.Browser.Navigate().GoToUrl(uri);

            EliteMovieEntryPoint eliteMovie = new EliteMovieEntryPoint();

            eliteMovie.Reserve(reserve);

            GenericApiValidator.AssertBookedSeats(seats);
        }
コード例 #4
0
        public void AfterReserveVerifyThatTheSeatsAreUnavailable()
        {
            this.driver.Navigate().GoToUrl(this.uri);

            Reserve reserve = new Reserve("El Violinista del Diablo", "2");

            reserve.Seats.Add(new Seat(4, 12));
            reserve.Seats.Add(new Seat(4, 13));
            reserve.Seats.Add(new Seat(4, 14));

            EliteMovieEntryPoint eliteMovie = new EliteMovieEntryPoint();

            eliteMovie.Reserve(reserve);

            ICollection <Seat> bookedSeats = eliteMovie.ObtainBookedSeats(reserve);

            foreach (Seat currentSeat in reserve.Seats)
            {
                CollectionAssert.Contains(bookedSeats, currentSeat);
            }
        }