Exemplo n.º 1
0
        public static IAddBugTo GenerateBasicAddBugToCommand(SeededData data, IssueType issueType, Guid?parentIssueId = null)
        {
            var  title       = "TITLE_" + random.Next(100000, 999999);
            var  description = "DESC" + random.Next(100000, 999999);
            Guid issueId;

            if (parentIssueId == null)
            {
                issueId = issueType == IssueType.Nfr ? data.NfrId : data.TaskId;
            }

            if (issueType == IssueType.Nfr)
            {
                return new AddBugToNfr(title, description, null, null)
                       {
                           ProjectId = data.ProjectId,
                           NfrId     = issueId
                       }
            }
            ;
            else
            {
                return new AddBugToTask(title, description, null, null)
                       {
                           ProjectId = data.ProjectId,
                           TaskId    = issueId
                       }
            };
        }
        private void SeedDataForPlant(PreservationContext dbContext, IServiceProvider scopeServiceProvider, string plant)
        {
            var knownData = new KnownTestData(plant);

            SeededData.Add(plant, knownData);
            dbContext.Seed(scopeServiceProvider, knownData);
        }
Exemplo n.º 3
0
 public ProjectGeneralTests(ProjectManagementFixture fixture)
 {
     this.fixture = fixture;
     context      = fixture.Module.Context;
     seededData   = fixture.Module.SeededData;
     random       = new Random();
 }
Exemplo n.º 4
0
        public static CreateNfr GenerateBasicCreateNfrCommand(SeededData data)
        {
            var title       = "TITLE_" + random.Next(100000, 999999);
            var description = "DESC" + random.Next(100000, 999999);

            return(new CreateNfr(title, description, null, null)
            {
                ProjectId = data.ProjectId
            });
        }
Exemplo n.º 5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            //when user clicks on sight, set up session to be able to navigatesite and keep stuff in the cart
            app.UseSession();

            app.UseRouting();

            app.UseAuthorization();

            //change the url so it has P1 and P1 instead
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute("catpage",
                                             "{category}/{pageNum:int}",
                                             new { Controller = "Home", action = "Index" }
                                             );

                endpoints.MapControllerRoute("pageNum",
                                             "{pageNum:int}",
                                             new { Controller = "Home", action = "Index" });

                endpoints.MapControllerRoute("category",
                                             "{category}",
                                             new { Controller = "Home", action = "Index", pageNum = 1 });

                endpoints.MapControllerRoute(
                    //Customize the URL Mapping to work for /P
                    "pagination",
                    "Books/P{pageNum}",
                    new { Controller = "Home", action = "Index" });

                endpoints.MapControllerRoute("pagination",
                                             "P{pageNum}",
                                             new { Controller = "Home", action = "Index" });

                endpoints.MapDefaultControllerRoute();
                //add routing for razor pages

                endpoints.MapRazorPages();
            });
            //pass in seed data
            SeededData.EnsurePopulated(app);
        }
Exemplo n.º 6
0
        protected override void Seed(Entityframeworkcodefirst.Context.GameContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            context.Teams.AddOrUpdate(
                t => t.TeamName,SeededData.getTeams().ToArray());
            context.SaveChanges();

            context.Players.AddOrUpdate(
                p => new {p.FirstName, p.LastName},SeededData.getPlayers(context).ToArray());
        }
Exemplo n.º 7
0
        public static void Main(string[] args)
        {
            //the seeding routine is from here: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app-xplat/working-with-sql?view=aspnetcore-2.0
            //this should change in 2.1
            var host = BuildWebHost(args);

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                try
                {
                    SeededData.Initialize(services);
                }
                catch (Exception exp)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(exp, "An error occurred seeding the Database");
                }
            }

            host.Run();
        }