示例#1
0
        public async Task InsertAsyncTest(int scheduleId, bool expectedStatus)
        {
            var schedule = new Schedule {
                CinemaHall = new CinemaHall {
                    CinemaHallId = 1
                }, ScheduleId = scheduleId
            };

            IList <Seat> seats = FakerUtil.SeatFaker.Generate(5);
            IEnumerable <Reservation> reservations = null;

            if (expectedStatus)
            {
                reservations = await reservationLogic.InsertAsync(schedule, seats);

                Assert.NotEmpty(reservations);
            }
            else
            {
                await Assert.ThrowsAsync <ArgumentException>(async() =>
                                                             await reservationLogic.InsertAsync(schedule, seats));

                Assert.Null(reservations);
            }
        }