public async void DeleteAsync_Works_DataMatches(User user, UserCompare equalityComparer, List <EfRepo.UserRepository> suts, SqlRepo.UserRepository sqlUserRepo) { foreach (var sut in suts) { var postEfUser = await sut.CreateAsync(user); sut.ClearChangeTracking(); var savedEfUser = await sut.GetByIdAsync(postEfUser.Id); Assert.True(savedEfUser != null); sut.ClearChangeTracking(); await sut.DeleteAsync(savedEfUser); sut.ClearChangeTracking(); savedEfUser = await sut.GetByIdAsync(savedEfUser.Id); Assert.True(savedEfUser == null); } var postSqlUser = await sqlUserRepo.CreateAsync(user); var savedSqlUser = await sqlUserRepo.GetByIdAsync(postSqlUser.Id); Assert.True(savedSqlUser != null); await sqlUserRepo.DeleteAsync(postSqlUser); savedSqlUser = await sqlUserRepo.GetByIdAsync(postSqlUser.Id); Assert.True(savedSqlUser == null); }
public async void UpdateRenewalReminderDateAsync_Works_DataMatches(User user, DateTime updatedReminderDate, List <EfRepo.UserRepository> suts, SqlRepo.UserRepository sqlUserRepo) { var savedDates = new List <DateTime?>(); foreach (var sut in suts) { var postEfUser = user; postEfUser = await sut.CreateAsync(user); sut.ClearChangeTracking(); await sut.UpdateRenewalReminderDateAsync(postEfUser.Id, updatedReminderDate); sut.ClearChangeTracking(); var replacedUser = await sut.GetByIdAsync(postEfUser.Id); savedDates.Add(replacedUser.RenewalReminderDate); } var postSqlUser = await sqlUserRepo.CreateAsync(user); await sqlUserRepo.UpdateRenewalReminderDateAsync(postSqlUser.Id, updatedReminderDate); var replacedSqlUser = await sqlUserRepo.GetByIdAsync(postSqlUser.Id); savedDates.Add(replacedSqlUser.RenewalReminderDate); var distinctItems = savedDates.GroupBy(e => e.ToString()); Assert.True(!distinctItems.Skip(1).Any() && savedDates.All(e => e.ToString() == updatedReminderDate.ToString())); }
public async void ReplaceAsync_Works_DataMatches(User postUser, User replaceUser, UserCompare equalityComparer, List <EfRepo.UserRepository> suts, SqlRepo.UserRepository sqlUserRepo) { var savedUsers = new List <User>(); foreach (var sut in suts) { var postEfUser = await sut.CreateAsync(postUser); replaceUser.Id = postEfUser.Id; await sut.ReplaceAsync(replaceUser); var replacedUser = await sut.GetByIdAsync(replaceUser.Id); savedUsers.Add(replacedUser); } var postSqlUser = await sqlUserRepo.CreateAsync(postUser); replaceUser.Id = postSqlUser.Id; await sqlUserRepo.ReplaceAsync(replaceUser); savedUsers.Add(await sqlUserRepo.GetByIdAsync(replaceUser.Id)); var distinctItems = savedUsers.Distinct(equalityComparer); Assert.True(!distinctItems.Skip(1).Any()); }
public async void CreateAsync_Works_DataMatches( User user, UserCompare equalityComparer, List <EfRepo.UserRepository> suts, SqlRepo.UserRepository sqlUserRepo ) { var savedUsers = new List <User>(); foreach (var sut in suts) { var postEfUser = await sut.CreateAsync(user); sut.ClearChangeTracking(); var savedUser = await sut.GetByIdAsync(postEfUser.Id); savedUsers.Add(savedUser); } var sqlUser = await sqlUserRepo.CreateAsync(user); savedUsers.Add(await sqlUserRepo.GetByIdAsync(sqlUser.Id)); var distinctItems = savedUsers.Distinct(equalityComparer); Assert.True(!distinctItems.Skip(1).Any()); }