예제 #1
0
        public void WhenGettingAllReminders_ThenReturnsAllReminders()
        {
            _reminderRepository
            .Setup(r => r.GetRemindersForVehicle(DefaultVehicleId))
            .Returns(GetListOfReminders);

            var handler = new GetAllRemindersForVehicle(_reminderRepository.Object);

            var reminders = handler.Execute(DefaultVehicleId);

            Assert.Equal(8, reminders.Count());
            Assert.True(reminders.Last().IsFulfilled);
        }
예제 #2
0
        public object GetReminders(int vehicleId)
        {
            var reminders = getAllRemindersForVehicle.Execute(vehicleId).Where(r => !r.IsFulfilled);

            return(new Page("Vehicles/Reminders/init")
            {
                Title = "Reminders",
                MasterPage = Url.Resource <GetVehicleMasterPageController>(),
                Data = new
                {
                    // TODO: Seems like a nasty SELECT N+1 bug here!
                    reminders = reminders.Select(r => new ReminderResource(r, getVehicleById.Execute(1, r.VehicleId), Url)),
                    add = Url.Post <PostRemindersController>()
                }
            });
        }