public void ExistsShouldReturnFalseWhenEntityWithTheGivenIdIsNotPresentedInDatabase() { ApplicationDbContext dbContext = this.GetNewDbContext(); var creditCompanyRepository = new EfRepository <CreditCompany>(dbContext); ICreditCompanyService creditCompanyService = new CreditCompanyService(creditCompanyRepository); Assert.False(creditCompanyService.Exists(Guid.NewGuid().ToString())); }
public async Task ExistsShouldReturnTrueWhenEntityWithTheGivenIdIsPresentedInDatabase() { const string id = "123"; const string name = "name"; ApplicationDbContext dbContext = this.GetNewDbContext(); dbContext.CreditCompanies.Add(new CreditCompany { Id = id, Name = name, }); await dbContext.SaveChangesAsync(); var creditCompanyRepository = new EfRepository <CreditCompany>(dbContext); ICreditCompanyService creditCompanyService = new CreditCompanyService(creditCompanyRepository); Assert.True(creditCompanyService.Exists(id)); }