Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            // Reset database and inject poe data
            using (var context = new PoeAppDbContext())
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
            }

            var retriever = new Retriever();

            retriever.InitializeBaseItemTable();


            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
        }
Exemplo n.º 2
0
        public void BaseItemWithTagsNotEmptyOrNullTest()
        {
            var connection = new SqliteConnection("Datasource=:memory:");

            connection.Open();

            var options = new DbContextOptionsBuilder <PoeAppDbContext>()
                          .UseSqlite(connection)
                          .Options;

            try
            {
                using (var context = new PoeAppDbContext(options))
                {
                    context.Database.EnsureCreated();
                }

                var retriever = new Retriever();

                retriever.InitializeBaseItemTable(options);

                using (var context = new PoeAppDbContext(options))
                {
                    var data = context
                               .BaseItems
                               .Include(item => item.PoeTagsLink);

                    foreach (var baseItem in data)
                    {
                        Assert.IsNotNull(baseItem.PoeTagsLink);
                        Assert.IsNotEmpty(baseItem.PoeTagsLink);

                        Assert.IsNotNull(baseItem.PoeTagsLink.First());

                        Assert.IsTrue(baseItem.PoeTagsLink.First().ItemKey != "");
                    }
                }
            }
            finally
            {
                connection.Close();
            }
        }