Beispiel #1
0
        public void EnsureShiftsAreReturned()
        {
            var system = A.Fake <IServiceRegistry>();

            A.CallTo(() => system.ShiftService.LoadShifts(null)).WithAnyArguments().Returns(new LoadShiftCollectionResponse {
                Shifts = new List <ShiftDto> {
                    new ShiftDto()
                }
            });

            A.CallTo(() => system.StaffService.LoadStaffList(new LoadStaffListRequest {
                RestaurantId = 1
            })).Returns(new StaffCollectionResponse {
                Staff = new List <StaffDto> {
                    new StaffDto()
                }
            });

            var action = new LoadShiftScheduleAction <dynamic>(system)
            {
                OnComplete = (m) => new { Value = m },
            };

            var result = action.Invoke(1, DateTime.Now, DateTime.Now, new List <int>()).Value as ShiftScheduleResultsViewModel;

            Assert.IsNotNull(result.Shifts.Any());
        }
Beispiel #2
0
        public PartialViewResult LoadShiftSchedule(string staffTypeIds, DateTime?weekFrom, DateTime?weekTo)
        {
            var action = new LoadShiftScheduleAction <PartialViewResult>(ServiceRegistry)
            {
                OnComplete = (model) => PartialView("ShiftScheduleResult", model)
            };

            var staffTypeIdList = StringUtils.ConvertToList(staffTypeIds);

            return(action.Invoke(ResolveRestaurantId(), weekFrom, weekTo, staffTypeIdList));
        }
Beispiel #3
0
        public void EnsureGuardAgainstNullOnComplete()
        {
            var error = "";

            try
            {
                var action = new LoadShiftScheduleAction <dynamic>(A.Fake <IServiceRegistry>());

                action.Invoke(0, DateTime.Now, DateTime.Now, new List <int>());
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }

            Assert.IsTrue(error.Contains("OnComplete"));
        }