public async Task ShouldFindMatch_WhenCatsAreAvailable() { using (var dbContext = DbContextFixture.GetDbContext()) { IMatchService service = new MatchService(dbContext, new RankingService(RankingValues.Limit, RankingValues.EvolutionCoef)); ICatService catService = new CatService(new HttpService(), dbContext, IConfigMock.GetCatsMock()); await catService.InjectCats().ConfigureAwait(false); // Prepare cats MatchIds matchIds = await service.FindMatchAsync().ConfigureAwait(false); Assert.NotEqual(0, matchIds.Left); Assert.NotEqual(0, matchIds.Right); } }
public async Task ShouldInjectCats_ProvidedByApi() { using (var dbContext = DbContextFixture.GetDbContext()) { var service = new CatService(new HttpService(), dbContext, IConfigMock.GetCatsMock()); var previousCount = dbContext.Cats.Count(); await service.InjectCats().ConfigureAwait(false); Cat[] cats = dbContext.Cats.ToArray(); Assert.NotNull(cats); Assert.NotEmpty(cats); Assert.True(previousCount == cats.Length); } }