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; }
private Mock <DataContext> SetupMockDbContext() { var result = new Mock <DataContext>(); Seeder.InitializeMockDataContext(result); return(result); }
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); }
public Form1() { InitializeComponent(); Seeder.SeedDatabase(context); btnAddProduct.Enabled = false; btnAddChild.Enabled = false; btnEdit.Enabled = false; }
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); }
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> >(); }
private static void Main() { var universe = Universe.Instance; Simulation.Add(universe); Seeder.Seed(universe); Simulation.Simulate(universe); }
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(); }); }
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); }
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); }
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); }
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); }
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); }
/// <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); }
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); }
// 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"); }); }
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); }
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); }
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"); }); }
// 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); }
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]; }
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(); } } }
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); } }
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); }