public async Task TestExporterForDatabase() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); var progressReporter = NoOpProgress <object> .Instance; using var db = ioc.GetInstance <CardDatabaseContext>(); /* * await new ParseVerb() * { * URI = "https://heartofthecards.com/translations/love_live!_sunshine_school_idol_festival_6th_anniversary_booster_pack.html" * }.Run(ioc); */ await new ParseVerb() { URI = "https://www.encoredecks.com/api/series/5d3232ec7cd9b718cd126e2e/cards" }.Run(ioc, progressReporter); await new ParseVerb() { URI = "https://www.heartofthecards.com/translations/little_busters!_anime_booster_pack.html" }.Run(ioc, progressReporter); IDatabaseExportInfo info = new MockDatabaseExportInfo(); await new CockatriceExporter().Export(db, info); }
public void Lamar() { var services = new ServiceCollection(); services.AddHttpClient("client") .AddHttpMessageHandler <RequestContentMd5Handler>() .AddHttpMessageHandler <HmacSigningHandler>(); var container = new Lamar.Container(services); container.Configure(config => { config.AddSingleton <ISecretRepository, SecretStore>(); config.AddTransient <ISignatureCalculator, HmacSignatureCalculator>(); config.AddTransient <IMessageRepresentationBuilder, HmacMessageRepresentationBuilder>(); config.AddTransient <RequestContentMd5Handler>(); }); var serviceProvider = container.GetInstance <IServiceProvider>(); var factory = serviceProvider.GetService <IHttpClientFactory>(); factory.CreateClient("client"); }
public async Task FullTestRun() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); await new ParseVerb { URI = "https://rebirth-for-you.fandom.com/wiki/Trial_Start_Deck_Is_the_Order_a_Rabbit%3F_BLOOM" }.Run(ioc); }
public Container(IOCModule module) { if (module is null) { throw new ArgumentNullException(nameof(module)); } container = new Lamar.Container(module.GetServices()); }
public async Task EnsureLatestVersion() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); var deckLogPP = ioc.GetInstance <DeckLogPostProcessor>(); var settings = DeckLogSettings.Japanese; var latestVersion = await deckLogPP.GetLatestVersion(settings); Assert.IsTrue(latestVersion == settings.Version, $"DeckLog API version is outdated; latest version is {latestVersion} need to check for compatibility."); }
/// <summary> /// With default scan /// </summary> public Container() { container = new Lamar.Container(c => { c.Scan(s => { s.TheCallingAssembly(); s.WithDefaultConventions(); }); }); }
public async Task TestClimaxTriggers() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); var bdml = await new Tools.Impls.Parsers.Cards.EncoreDecksParser().Parse("https://www.encoredecks.com/?page=1&set=5cf701347cd9b718cdf21469") .ToDictionaryAsync(c => c.Serial); Assert.IsTrue(bdml["BD/EN-W03-125"].Triggers.Length == 2); Assert.IsTrue(bdml["BD/EN-W03-125"].Triggers.Contains(Trigger.Gate)); Assert.IsTrue(bdml["BD/EN-W03-126"].Triggers.Contains(Trigger.Book)); }
public async Task FullTestRun() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); await new ParseVerb() { URI = "./shiyoko_prs_hotc.txt", ParserHints = new string[] { "hotc" } }.Run(ioc); }
public async Task TraitTestRun() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); var batmanNinja = await new Tools.Impls.Parsers.Cards.EncoreDecksParser().Parse("https://www.encoredecks.com/api/series/5d3232ec7cd9b718cd126e2e/cards") // .ToDictionaryAsync(c => c.Serial); Assert.IsTrue(batmanNinja["BNJ/SX01-T07"].Traits.Count == 0); Assert.IsTrue(batmanNinja["BNJ/SX01-A13"].Traits.Count == 0); Assert.IsTrue(batmanNinja["BNJ/SX01-078b"].Traits.Select(mls => mls.EN).All(trait => new[] { "Sengoku", "Weapon" }.Contains(trait))); }
public async Task FullTestRun() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); var progress = NoOpProgress <CommandProgressReport> .Instance; await new ParseVerb() { URI = "./shiyoko_prs_hotc.txt", ParserHints = new string[] { "hotc" } }.Run(ioc, progress); }
public async Task TestPISerials() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); var progress = NoOpProgress <SetParserProgressReport> .Instance; var ct = CancellationToken.None; var prismaIllyaEN = await new Tools.Impls.Parsers.Cards.EncoreDecksParser() .Parse("https://www.encoredecks.com/?page=1&set=5c7b101d7cd9b718cdbd085e", progress, ct) .ToDictionaryAsync(c => c.Serial); Assert.IsTrue(prismaIllyaEN["PI/EN-S04-E038"] != null); }
public async Task TestPIAkiba() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); var progress = NoOpProgress <SetParserProgressReport> .Instance; var ct = CancellationToken.None; var prismaIllyaHertz = await new Tools.Impls.Parsers.Cards.EncoreDecksParser() .Parse("https://www.encoredecks.com/api/series/5d9a1ccc7cd9b718cd5b2200/cards", progress, ct) .ToDictionaryAsync(c => c.Serial); Assert.IsTrue(prismaIllyaHertz["PI/S40-038"].Name.EN == null); }
public async Task TestFullIntegrationTest() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); await new ParseVerb { URI = "https://rebirth-for-you.fandom.com/wiki/Trial_Deck_Hololive_Production_(ver._0th_Gen)" }.Run(ioc); await new ParseVerb { URI = "https://rebirth-for-you.fandom.com/wiki/Trial_Deck_Hololive_Production_(ver._1st_Gen)" }.Run(ioc); var testSerial = await ioc.GetInstance <CardDatabaseContext>().R4UCards.FindAsync("HP/001T-013"); var deck = await ioc.GetInstance <DeckLogParser>().Parse("https://decklog.bushiroad.com/view/3H0N"); }
public async Task FullTestRun() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); await new ParseVerb() { URI = "https://www.encoredecks.com/?page=1&set=5cfbffe67cd9b718cdf4b439" }.Run(ioc); await new ExportVerb() { Source = "./deck_date_a_live.json", Exporter = "local", NonInteractive = true, NoWarning = true }.Run(ioc); Assert.IsTrue(Path.Get("./Export/deck_date_a_live.json").Exists); }
public async Task FullTestRun() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); var batmanNinja = new Tools.Impls.Parsers.Cards.EncoreDecksParser().Parse("https://www.encoredecks.com/api/series/5d3232ec7cd9b718cd126e2e/cards"); Assert.IsTrue(await batmanNinja.AnyAsync(c => c.Serial == "BNJ/BCS2019-02")); var bdml = new Tools.Impls.Parsers.Cards.EncoreDecksParser().Parse("https://www.encoredecks.com/?page=1&set=5cf701347cd9b718cdf21469"); Assert.IsTrue(await bdml.AnyAsync(c => c.Serial == "BD/EN-W03-007" || c.Effect.Length < 1), "BD/EN-W03 might have not been parsed correctly; do check."); var lbAnime = new Tools.Impls.Parsers.Cards.EncoreDecksParser().Parse("https://www.encoredecks.com/?page=1&set=5d6d4e147cd9b718cd3a0d40"); Log.Information("LB Anime Set has been parsed successfully. This was a set that is not translated when this Unit Test was created."); var serialChecklist = new[] { "LB/W21-078", "LB/W21-065" }; Assert.IsTrue(await bdml.AnyAsync(c => !serialChecklist.Contains(c.Serial)), "LB/W21 might have not been parsed correctly; do check."); }
public async Task HololiveRun() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); await new ParseVerb { URI = "https://rebirthforyourenegades.wordpress.com/2020/12/02/hp-001b-full-set-list/" }.Run(ioc); using (var db = ioc.GetInstance <CardDatabaseContext>()) { var sora = await db.R4UCards.FindAsync("HP/001B-001"); Assert.IsTrue(sora.Name.JP == "新時代のアイドル そら"); Assert.IsTrue(sora.Name.EN == "Idol of the New Era, Sora"); var soraSP2 = await db.R4UCards.FindAsync("HP/001B-001SP_2"); Assert.IsTrue(soraSP2.Rarity == "SP"); Assert.IsTrue(soraSP2.NonFoil == sora); } }
public async Task FullTestRun() { Serilog.Log.Logger = TestUtils.BootstrapLogging().CreateLogger(); Lamar.Container ioc = Program.Bootstrap(); await new ParseVerb { URI = "https://rebirthforyourenegades.wordpress.com/2020/12/23/th-001e-full-set-list/" }.Run(ioc); await new ParseVerb { URI = "https://rebirthforyourenegades.wordpress.com/2021/02/24/imc-001b-full-set-list/" }.Run(ioc); using (var db = ioc.GetInstance <CardDatabaseContext>()) { var chieri = await db.R4UCards.FindAsync("IMC/001B-015"); Assert.IsTrue(chieri.Name.JP == "緒方 智絵里"); Assert.IsTrue(chieri.Name.EN == "Chieri Ogata"); Assert.IsTrue(chieri.Traits.Any(t => t.EN == "Cute")); Assert.IsTrue(chieri.ATK == 2); Assert.IsTrue(chieri.DEF == 3); Assert.IsTrue(chieri.Effect.Any(e => e.EN == "[AUTO]:When this character is put onto your member area from hand, choose a character each from your retire area and hand, and you may exchange their positions.")); } }
public Container(IServiceCollection services) { container = new Lamar.Container(services); }
public void applies_the_Configure_RoutedChain_method() { var chain = RouteChain.For <ConfiguredEndpoint>(x => x.get_configured()); var frames = chain.DetermineFrames(ConnegRules.Empty(), new GenerationRules(), Container.Empty()); frames.OfType <FakeTransaction>().Any().ShouldBeTrue(); }
public void applies_attributes_against_the_RouteChain() { var chain = RouteChain.For <ConfiguredEndpoint>(x => x.get_wrapper2()); var frames = chain.DetermineFrames(ConnegRules.Empty(), new GenerationRules(), Container.Empty()); frames.OfType <FakeWrapper2>().Any().ShouldBeTrue(); }