public async Task UpdateBanlist_SourcesGiveUsValidData_DbContainValidNumberOfForbiddenAndLimitedAndSemiLimitedCards() { var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); var dbContextSqliteOptions = new DbContextOptionsBuilder <YgoProAnalyticsDatabase>() .UseSqlite(connection) .ConfigureWarnings(x => x.Ignore(RelationalEventId.QueryClientEvaluationWarning)) .Options; using (var db = new YgoProAnalyticsDatabase(dbContextSqliteOptions)) { db.Database.EnsureCreated(); var archetype = new Archetype(Archetype.Default, true); _addChangeOfHeart(db, archetype); _addChickenGame(db, archetype); _addTerraforming(db, archetype); await db.SaveChangesAsync(); var updater = new BanlistDataToBanlistUpdater(db, _banlistDataDownloaderMock.Object); await updater.UpdateBanlists("https://raw.githubusercontent.com/szefo09/updateYGOPro2/master/lflist.conf"); await _verifyForTCGBanlist(db); await _verifyForOCGBanlist(db); } }
public async Task UpdateBanlists_SourcesShouldBeAvailable_DbInMemoryIsUpdated() { var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); var dbContextSqliteOptions = new DbContextOptionsBuilder <YgoProAnalyticsDatabase>() .UseSqlite(connection) .ConfigureWarnings(x => x.Ignore(RelationalEventId.QueryClientEvaluationWarning)) .Options; using (var db = new YgoProAnalyticsDatabase(dbContextSqliteOptions)) { db.Database.EnsureCreated(); var _updater = new CardsDataToCardsAndArchetypesUpdater(new CardsDataDownloader(), new CardBuilder(), db); await _updater.UpdateCardsAndArchetypes("https://db.ygoprodeck.com/api/v3/cardinfo.php"); var updater = new BanlistDataToBanlistUpdater(db, new BanlistDataDownloader()); var newBanlists = await updater.UpdateBanlists("https://raw.githubusercontent.com/szefo09/updateYGOPro2/master/lflist.conf"); Assert.Greater(newBanlists.Count(), 0); } }