Esempio n. 1
0
        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 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");
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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.");
        }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
        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."));
            }
        }
Esempio n. 7
0
 public object Resolve(Type type)
 {
     return(container.GetInstance(type));
 }
Esempio n. 8
0
 public object GetService(Type serviceType)
 {
     return(container.GetInstance(serviceType));
 }