Exemplo n.º 1
0
        public async Task LoadAndSeedAndCleanDataFull()
        {
            Console.WriteLine("characters...");
            await ReloadCharacters();

            Console.WriteLine("smash attribute values...");
            await ReloadSmashAttributeTypes();

            Console.WriteLine("movements...");
            await ReloadMovements();

            Console.WriteLine("moves...");
            await ReloadMoves();

            Console.WriteLine("char attr values...");
            await ReloadSmash4CharacterAttributeValues();

            Console.WriteLine("seeding and cleaning all data...");
            using (var context = new AppDbContext())
            {
                var seeder = new Seeder(context);
                seeder.SeedAll();
            }

            Console.WriteLine("Done.");
        }
 public PrimeCalculatorImpl(Seeder seeder, WorkerPool pool)
 {
     _seeder = seeder;
     _pool = pool;
     _pool.PushResult += PoolOnPushResult;
     _pool.TakeTask += PoolOnTakeTask;
     _pool.FreeTask += PoolOnFreeTask;
 }
Exemplo n.º 3
0
        private Mock <DataContext> SetupMockDbContext()
        {
            var result = new Mock <DataContext>();


            Seeder.InitializeMockDataContext(result);

            return(result);
        }
Exemplo n.º 4
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Seeding database...");
            var seeder = new Seeder();

            seeder.Seed();
            Console.WriteLine("Seeding complete!");
            System.Threading.Thread.Sleep(1000);
        }
Exemplo n.º 5
0
        public Form1()
        {
            InitializeComponent();
            Seeder.SeedDatabase(context);

            btnAddProduct.Enabled = false;
            btnAddChild.Enabled   = false;
            btnEdit.Enabled       = false;
        }
Exemplo n.º 6
0
        public Form1()
        {
            InitializeComponent();
            MyContext context = new MyContext();

            Seeder.SeedDatabase(context);
            comboBox1.SelectedIndex = 0;
            btnAction.Visible       = false;
        }
        public static List <EmailTemplate> GetEmailTemplatesFromJson(string relativePath)
        {
            var       initialData = Seeder.GetJsonStub <Rootobject>("Data", relativePath);
            var       items       = new List <EmailTemplate>();
            var       rnd         = new Random();
            const int MAX         = 150;

            initialData.ArrayOfEmailTemplate.EmailTemplate.ToList().ForEach(e =>
            {
                var item = new EmailTemplate
                {
                    ParentId     = Guid.Parse(e.ParentId),
                    Id           = Guid.Parse(e.Id),
                    EmailLabel   = e.EmailLabel,
                    FromAddress  = $"{rnd.Next(MAX)}{e.FromAddress}",
                    Subject      = e.Subject,
                    TemplateText = e.TemplateText,
                    EmailType    = e.EmailType,
                    Active       = bool.Parse(e.Active),
                    DateUpdated  = e.DateUpdated.AddHours(rnd.Next(MAX)),
                    LoadDrafts   = bool.Parse(e.LoadDrafts),
                    IsDefault    = bool.Parse(e.IsDefault),
                    BccAddress   = e.BccAddress,
                    VersionCount = int.Parse(e.VersionCount)
                };

                if (e.Versions.EmailTemplate.Any())
                {
                    e.Versions.EmailTemplate.ToList().ForEach(v =>
                    {
                        item.Versions = new List <EmailTemplate>();

                        item.Versions.Add(new EmailTemplate
                        {
                            ParentId     = Guid.Parse(v.ParentId),
                            Id           = Guid.Parse(v.Id),
                            EmailLabel   = v.EmailLabel,
                            FromAddress  = $"{rnd.Next(MAX)}{v.FromAddress}",
                            Subject      = v.Subject,
                            TemplateText = v.TemplateText,
                            EmailType    = v.EmailType,
                            Active       = bool.Parse(v.Active),
                            DateUpdated  = v.DateUpdated.AddHours(rnd.Next(MAX)),
                            LoadDrafts   = bool.Parse(v.LoadDrafts),
                            IsDefault    = bool.Parse(v.IsDefault),
                            BccAddress   = v.BccAddress,
                            VersionCount = int.Parse(v.VersionCount)
                        });
                    });
                }

                items.Add(item);
            });

            return(items);
        }
Exemplo n.º 8
0
        protected EngineTestBase()
        {
            racesStub    = Seeder.GetJsonStubs <Race>("races", SAMPLE_DATA_SOURCES);
            betStub      = Seeder.GetJsonStubs <Bet>("bets", SAMPLE_DATA_SOURCES);
            customerStub = Seeder.GetJsonStubs <Customer>("customers", SAMPLE_DATA_SOURCES);

            raceRepository     = Substitute.For <ITechChallengeDataRepositorySoftDeleteInt <Race> >();
            betRepository      = Substitute.For <ITechChallengeDataRepositorySoftDeleteInt <Bet> >();
            customerRepository = Substitute.For <ITechChallengeDataRepositorySoftDeleteInt <Customer> >();
        }
Exemplo n.º 9
0
        private static void Main()
        {
            var universe = Universe.Instance;

            Simulation.Add(universe);

            Seeder.Seed(universe);

            Simulation.Simulate(universe);
        }
Exemplo n.º 10
0
        public void FillListWithExpense_01_CheckIfExpenseExistsInList_ReturnsTrue()
        {
            var seeder = new Seeder();

            seeder.FillListWithExpenses();
            var expense = BudgetCalculator.listOfEconomy.Find(x => x is Expense);
            var actual  = expense is Expense;

            Assert.IsTrue(actual);
        }
        public static void Seed(EcomEngineDb context, string relativePath)
        {
            Seeder.Execute("EmailTemplates", () =>
            {
                var initialData = GetEmailTemplatesFromJson(relativePath);

                context.AddRange(initialData);
                context.SaveChanges();
            });
        }
Exemplo n.º 12
0
        public static void ApplyMigrations(this IApplicationBuilder app)
        {
            using var services = app.ApplicationServices.CreateScope();

            var dbContext = services.ServiceProvider.GetService <ApplicationDbContext>();

            dbContext.Database.Migrate();

            Seeder.Seed(dbContext);
        }
Exemplo n.º 13
0
 public TeacherReviewedServiceTests()
 {
     this.seeder = new Seeder();
     AutoMapperConfig.RegisterMappings(
         typeof(Essay).GetTypeInfo().Assembly,
         typeof(EssayViewModel).GetTypeInfo().Assembly);
     AutoMapperConfig.RegisterMappings(
         typeof(Grade).GetTypeInfo().Assembly,
         typeof(GradeViewModel).GetTypeInfo().Assembly);
 }
Exemplo n.º 14
0
        public static void Seed(TestDb context, string relativeFolder)
        {
            Seeder.Execute("Customers", () =>
            {
                var intialData = Seeder.GetJsonStubs <Customer>("customers", relativeFolder);

                context.Customers.AddRange(intialData);
                context.DoSave("Customer");
            });
        }
        public void FillListWithIncome_01_CheckIfSavingExistsInList_ReturnsEqual()
        {
            var seeder = new Seeder();

            seeder.FillListWithSavings();
            var saving = BudgetCalculator.savingsList.Find(x => x is Saving);
            var actual = saving is Saving;

            Assert.IsTrue(actual);
        }
Exemplo n.º 16
0
 public RoleServiceTests()
 {
     this.seeder = new Seeder();
     AutoMapperConfig.RegisterMappings(
         typeof(CreateViewModel).GetTypeInfo().Assembly,
         typeof(ApplicationRole).GetTypeInfo().Assembly);
     AutoMapperConfig.RegisterMappings(
         typeof(ApplicationRole).GetTypeInfo().Assembly,
         typeof(RoleViewModel).GetTypeInfo().Assembly);
 }
Exemplo n.º 17
0
        public HttpResponseMessage Seed()
        {
            ThrowIfLiveEnvironment();

            Seeder.Seed(WebApiApplication.DocumentStore);

            return(new HttpResponseMessage {
                Content = new StringContent("Done")
            });
        }
        public void FillListWithIncome_01_CheckIfIncomeExistsInList_ReturnsTrue()
        {
            var seeder = new Seeder();

            seeder.FillListWithIncome();
            var income = BudgetCalculator.listOfEconomy.Find(x => x is Income);
            var actual = income is Income;

            Assert.IsTrue(actual);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Instantiates a new instance of <see cref="IntegrationTest"/> class.
        /// </summary>
        protected IntegrationTest(IntegrationTestFixture fixture)
        {
            // By placing the initialization logic in the constructor, we ensure that
            // database/etc initialization is done per each [Fact] method.
            this.Container = fixture.Container;

            this.Seeder = new Seeder(
                this.Container,
                new DatabaseEntityTracker());
        }
        public void FillListWithIncome_03_CheckIfSavingPropertySetsValue_ReturnsEqual()
        {
            var seeder = new Seeder();

            BudgetCalculator.savingsList.Add(null);
            var expected = BudgetCalculator.savingsList.Find(x => x.Name == "Unknown");
            var actual   = "Unknown";

            Assert.AreEqual(actual, expected.Name);
        }
Exemplo n.º 21
0
 public TeacherServiceTests()
 {
     this.seeder = new Seeder();
     AutoMapperConfig.RegisterMappings(
         typeof(Essay).GetTypeInfo().Assembly,
         typeof(EssayViewModel).GetTypeInfo().Assembly);
     AutoMapperConfig.RegisterMappings(
         typeof(Category).GetTypeInfo().Assembly,
         typeof(CategoryDropDownViewModel).GetTypeInfo().Assembly);
 }
Exemplo n.º 22
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseMvc();
            var dataText = System.IO.File.ReadAllText(@"weatherdataseed.json");

            Seeder.Seedit(dataText, app.ApplicationServices);
        }
        public static void Seed(TestDb context, string relativeFolder)
        {
            Seeder.Execute("Races", () =>
            {
                var intialData = Seeder.GetJsonStubs <Race>("races", relativeFolder);

                context.Races.AddRange(intialData);
                context.DoSave("Race");
            });
        }
Exemplo n.º 24
0
        public static IHost Seed(this IHost webHost)
        {
            using (var scope = webHost.Services.GetService <IServiceScopeFactory>().CreateScope()) {
                using (var dbContext = scope.ServiceProvider.GetRequiredService <NetCoreExampleDbContext>()) {
                    Seeder.SeedDataAsync(scope, dbContext).GetAwaiter().GetResult();
                }
            }

            return(webHost);
        }
Exemplo n.º 25
0
 public UserServiceTests()
 {
     this.seeder = new Seeder();
     AutoMapperConfig.RegisterMappings(
         typeof(ApplicationUser).GetTypeInfo().Assembly,
         typeof(ContestantViewModel).GetTypeInfo().Assembly);
     AutoMapperConfig.RegisterMappings(
         typeof(ApplicationUser).GetTypeInfo().Assembly,
         typeof(DetailsViewModel).GetTypeInfo().Assembly);
 }
Exemplo n.º 26
0
        public void SetUp()
        {
            var seeder = new Seeder();

            seeder.FillListWithIncome();
            seeder.FillListWithExpenses();
            seeder.FillListWithSavings();
            BudgetCalculator.succesfulWithdrawns.Clear();
            Saving.successfulSavingsWithdrawn.Clear();
        }
        public static void Seed(TestDb context, string relativeFolder)
        {
            Seeder.Execute("Bets", () =>
            {
                var intialData = Seeder.GetJsonStubs <Bet>("bets", relativeFolder);

                context.Bets.AddRange(intialData);
                context.DoSave("Bet");
            });
        }
Exemplo n.º 28
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();

            Seeder.SeedDatabase(app.ApplicationServices);
        }
Exemplo n.º 29
0
        private void InitModules()
        {
            // init everything here so they don't need to be instantiated later
            VoronoiNoise.Init();
            MaterialController.Init();
            TextureController.Init();
            OptController.Init();
            Seeder.Init(islandDensity);

            method = Constants.NoiseFuncs [(int)noiseType];
        }
Exemplo n.º 30
0
 private async Task SeedDatabaseAsync(IApplicationBuilder app, bool willSeed)
 {
     if (willSeed)
     {
         using (var serviceScope = app.ApplicationServices.CreateScope())
         {
             var seeder = new Seeder(serviceScope.ServiceProvider, this.Configuration);
             await seeder.SeedAsync();
         }
     }
 }
Exemplo n.º 31
0
        public Startup(IConfiguration configuration, IHostingEnvironment env)
        {
            Configuration = configuration;
            WebRootPath   = env.WebRootPath;
            var context = new CustomersEntitiesDataContext();

            if (context.Customers.Count() < 5000)
            {
                Seeder.Seed(context, 5000, WebRootPath);
            }
        }
Exemplo n.º 32
0
        public void Setup()
        {
            _mockContext = new Mock <DataContext>();

            Seeder.InitializeMockDataContext(_mockContext);

            var claim = new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"
                                  , _mockContext.Object.Users.Single(x => x.UserName == "adhach").Id.ToString());

            _facade = new ParameterTypeFacade(_mockContext.Object);
        }