コード例 #1
0
        public void TestCancelReservationTooLate()
        {
            var db = new MockUnitOfWork();

            (db.Repo <Reservation>() as MockReservationRepo).Reservation.Showing.Time = DateTime.Now.AddMinutes(20);
            var reservationFlow = CreateController(db);

            var     result = reservationFlow.CancelReservation(0) as JsonResult;
            dynamic data   = result.Data;

            Assert.IsFalse(data.success);
        }
コード例 #2
0
        private JsonResult MakeReservationHelper(ReservationFlowViewModel model)
        {
            var db = new MockUnitOfWork();

            model.Movie         = model.Movie ?? new Movie();
            model.Showing       = model.Showing ?? db.Repo <Showing>().Get(0);
            model.Showing.Movie = model.Showing.Movie ?? new Movie();

            model.TakenPlaces    = model.TakenPlaces ?? (db.Repo <Place>() as IPlacesRepo).GetTakenPlaces(0);
            model.SelectedPlaces = model.SelectedPlaces ?? new List <PlacePosition> {
                new PlacePosition {
                    x = 0, y = 1
                }
            };
            model.PostUrl = model.PostUrl ?? "test";

            (db.Repo <Showing>() as MockShowingsRepo).Showing = model.Showing;

            var reservationFlow = CreateController(db);

            return(reservationFlow.MakeReservation(model) as JsonResult);
        }