public async void DeleteAsync_Works_DataMatches(SsoUser ssoUser, Organization org, User user, SsoUserCompare equalityComparer, List <EfRepo.SsoUserRepository> suts, List <EfRepo.UserRepository> efUserRepos, List <EfRepo.OrganizationRepository> efOrgRepos, SqlRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.UserRepository sqlUserRepo, SqlRepo.OrganizationRepository sqlOrganizationRepo) { foreach (var sut in suts) { var i = suts.IndexOf(sut); var savedEfUser = await efUserRepos[i].CreateAsync(user); var savedEfOrg = await efOrgRepos[i].CreateAsync(org); sut.ClearChangeTracking(); ssoUser.UserId = savedEfUser.Id; ssoUser.OrganizationId = savedEfOrg.Id; var postEfSsoUser = await sut.CreateAsync(ssoUser); sut.ClearChangeTracking(); var savedEfSsoUser = await sut.GetByIdAsync(postEfSsoUser.Id); Assert.True(savedEfSsoUser != null); sut.ClearChangeTracking(); await sut.DeleteAsync(savedEfSsoUser); savedEfSsoUser = await sut.GetByIdAsync(savedEfSsoUser.Id); Assert.True(savedEfSsoUser == null); } var sqlUser = await sqlUserRepo.CreateAsync(user); var sqlOrganization = await sqlOrganizationRepo.CreateAsync(org); ssoUser.UserId = sqlUser.Id; ssoUser.OrganizationId = sqlOrganization.Id; var postSqlSsoUser = await sqlSsoUserRepo.CreateAsync(ssoUser); var savedSqlSsoUser = await sqlSsoUserRepo.GetByIdAsync(postSqlSsoUser.Id); Assert.True(savedSqlSsoUser != null); await sqlSsoUserRepo.DeleteAsync(savedSqlSsoUser); savedSqlSsoUser = await sqlSsoUserRepo.GetByIdAsync(postSqlSsoUser.Id); Assert.True(savedSqlSsoUser == null); }
public async void CreateAsync_Works_DataMatches(SsoUser ssoUser, User user, Organization org, SsoUserCompare equalityComparer, List <EfRepo.SsoUserRepository> suts, List <EfRepo.OrganizationRepository> efOrgRepos, List <EfRepo.UserRepository> efUserRepos, SqlRepo.SsoUserRepository sqlSsoUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo, SqlRepo.UserRepository sqlUserRepo) { var createdSsoUsers = new List <SsoUser>(); foreach (var sut in suts) { var i = suts.IndexOf(sut); var efUser = await efUserRepos[i].CreateAsync(user); var efOrg = await efOrgRepos[i].CreateAsync(org); sut.ClearChangeTracking(); ssoUser.UserId = efUser.Id; ssoUser.OrganizationId = efOrg.Id; var postEfSsoUser = await sut.CreateAsync(ssoUser); sut.ClearChangeTracking(); var savedSsoUser = await sut.GetByIdAsync(ssoUser.Id); createdSsoUsers.Add(savedSsoUser); } var sqlUser = await sqlUserRepo.CreateAsync(user); var sqlOrganization = await sqlOrgRepo.CreateAsync(org); ssoUser.UserId = sqlUser.Id; ssoUser.OrganizationId = sqlOrganization.Id; var sqlSsoUser = await sqlSsoUserRepo.CreateAsync(ssoUser); createdSsoUsers.Add(await sqlSsoUserRepo.GetByIdAsync(sqlSsoUser.Id)); var distinctSsoUsers = createdSsoUsers.Distinct(equalityComparer); Assert.True(!distinctSsoUsers.Skip(1).Any()); }