public void WhenDeletingReminder_ThenPersists() { var repository = new ReminderRepository(this.GetUnitOfWork()); Reminder reminder = new Reminder() { DueDate = DateTime.UtcNow.AddDays(30), DueDistance = 1000, Title = "Test Reminder" }; repository.Create(this.defaultVehicle.VehicleId, reminder); var repositoryForDelete = new ReminderRepository(this.GetUnitOfWork()); Assert.Equal(1, repositoryForDelete.GetRemindersForVehicle(this.defaultVehicle.VehicleId).Count()); repositoryForDelete.Delete(reminder.ReminderId); var repositoryForVerification = new ReminderRepository(this.GetUnitOfWork()); var returnedReminders = repositoryForVerification.GetRemindersForVehicle(this.defaultVehicle.VehicleId); Assert.NotNull(returnedReminders); Assert.Equal(0, returnedReminders.Count()); }
public void WhenUpdatingReminder_ThenPersists() { var repository = new ReminderRepository(this.GetUnitOfWork()); Reminder reminder = new Reminder() { DueDate = DateTime.UtcNow.AddDays(30), DueDistance = 1000, Title = "Test Reminder" }; repository.Create(this.defaultVehicle.VehicleId, reminder); var repositoryForUpdate = new ReminderRepository(this.GetUnitOfWork()); var reminderToUpdate = repositoryForUpdate.GetRemindersForVehicle(this.defaultVehicle.VehicleId).First(); reminderToUpdate.Title = "updated"; repositoryForUpdate.Update(reminderToUpdate); var repositoryForVerification = new ReminderRepository(this.GetUnitOfWork()); var returnedReminder = repositoryForVerification.GetRemindersForVehicle(this.defaultVehicle.VehicleId).First(); Assert.NotNull(returnedReminder); Assert.Equal("updated", returnedReminder.Title); }
public void WhenCreatingReminder_ThenPersists() { var repository = new ReminderRepository(); Reminder reminder = new Reminder() { DueDate = DateTime.UtcNow.AddDays(30), DueDistance = 1000, Title = "Test Reminder" }; repository.Create(defaultVehicle.VehicleId, reminder); var repositoryForVerification = new ReminderRepository(); var returnedReminder = repositoryForVerification.GetRemindersForVehicle(defaultVehicle.VehicleId).First(); Assert.NotNull(returnedReminder); Assert.Equal("Test Reminder", returnedReminder.Title); }
public void WhenDeletingReminder_ThenPersists() { var repository = new ReminderRepository(); Reminder reminder = new Reminder() { DueDate = DateTime.UtcNow.AddDays(30), DueDistance = 1000, Title = "Test Reminder" }; repository.Create(defaultVehicle.VehicleId, reminder); var repositoryForDelete = new ReminderRepository(); Assert.Equal(1, repositoryForDelete.GetRemindersForVehicle(defaultVehicle.VehicleId).Count()); repositoryForDelete.Delete(reminder.ReminderId); var repositoryForVerification = new ReminderRepository(); var returnedReminders = repositoryForVerification.GetRemindersForVehicle(defaultVehicle.VehicleId); Assert.NotNull(returnedReminders); Assert.Equal(0, returnedReminders.Count()); }