Example #1
0
        public void IsFreeSeatTest()
        {
            List <SeatModel> Seats = new List <SeatModel>()
            {
                new SeatModel {
                    IsReserve = false
                },
                new SeatModel {
                    IsReserve = false
                },
                new SeatModel {
                    IsReserve = true
                },
                new SeatModel {
                    IsReserve = false
                },
                new SeatModel {
                    IsReserve = true
                }
            };

            SeatValidator validator = new SeatValidator(Seats);

            Assert.IsTrue(validator.IsSeatValid(1) == true);
            Assert.IsTrue(validator.IsSeatValid(2) == true);
            Assert.IsTrue(validator.IsSeatValid(3) == false);
            Assert.IsTrue(validator.IsSeatValid(4) == true);
            Assert.IsTrue(validator.IsSeatValid(5) == false);
            Assert.IsTrue(validator.IsSeatValid(22) == false);
        }
Example #2
0
        public ActionResult SeatsDataMovie(PersonModelUI model)
        {
            if (ModelState.IsValid)
            {
                if (seatValidator.IsSeatValid(model.SeatNumber))
                {
                    DataProcessor.PrepareReservation(model.FirstName, model.LastName,
                                                     model.EmailAdress, model.SeatNumber, NumberMovie);

                    return(RedirectToAction("SeatsDataMovie"));
                }
            }
            return(RedirectToAction("ErrorSeats"));
        }