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); }
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>() } }); }