protected Seed(DbContextOptions options) { this.Container = new DataSeedDiContainer(options); this.Seeder = new Seeder( this.Container, new DatabaseEntityTracker()); }
/// <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 IntegrationTestFixture() { var dbContextOptions = ConfigurationReader.GetConfigurations().DbContextOptions(); using (var connection = dbContextOptions.GetConnection()) { connection.Open(); Database.TruncateDatabase(connection).Wait(); } this.Container = new DataSeedDiContainer(dbContextOptions); this.Container.Container.GetInstance <DataSeed>().SeedRequiredData().Wait(); }
public async Task CanCompileEmail() { var container = new DataSeedDiContainer(); var emailTemplateRegister = container.Container.GetInstance <EmailTemplateRegister>(); var user = RegisteredUser.Create(1, "jack"); var workItem = new WorkItem("do magic", user); var model = new CategoryCreatedTemplate.Model(workItem, new AppConfig()); var email = await emailTemplateRegister.CompileEmail( "*****@*****.**", model); email.Should().NotBeNull(); }
public void EachEventInvokationGetsNewInstanceOfEventHandler() { var container = new DataSeedDiContainer().Container; container.GetInstance <DependencyInjectionContainer>().RegisterUiMetadata(typeof(EventManagerTest).GetTypeInfo().Assembly); var eventManager = container.GetInstance <EventManager>(); eventManager.RegisterAssembly(typeof(EventManagerTest).Assembly); eventManager.Streams.Publish(new SomethingHappenedEvent()); eventManager.Streams.Publish(new SomethingHappenedEvent()); Logger.HashCodes.Count.ShouldBeEquivalentTo(2); Logger.HashCodes["loggers"][0].Should().NotBe(Logger.HashCodes["loggers"][1]); }
public async Task CanCompileEmail() { var container = new DataSeedDiContainer(); var emailTemplateRegister = container.Container.GetInstance <EmailTemplateRegister>(); var user = RegisteredUser.Create(1, "jack"); var activityType = new ActivityType("do magic", user.Id, "SP", 1, null, null); var activity = new Activity(user.Id, activityType, 1, null, DateTime.Today); var model = new ActivityRecordedTemplate.Model(activity, new AppConfig()); var email = await emailTemplateRegister.CompileEmail( "*****@*****.**", model); email.Should().NotBeNull(); }
public UserQuery(string entityName, DataSeedDiContainer container, DatabaseEntityTracker tracker) : base(container, tracker) { this.EntityName = entityName; }
public LeaveTypeQuery(string entityName, DataSeedDiContainer container, DatabaseEntityTracker tracker) : base(entityName, container, tracker) { }
public Seeder(DataSeedDiContainer container, DatabaseEntityTracker tracker) { this.Container = container; this.Tracker = tracker; }
public ActivityQuery(string entityName, DataSeedDiContainer container, DatabaseEntityTracker tracker) : base(entityName, container, tracker) { }