Beispiel #1
0
        protected Seed(DbContextOptions options)
        {
            this.Container = new DataSeedDiContainer(options);

            this.Seeder = new Seeder(
                this.Container,
                new DatabaseEntityTracker());
        }
Beispiel #2
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());
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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();
        }
Beispiel #5
0
        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]);
        }
Beispiel #6
0
        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();
        }
Beispiel #7
0
 public UserQuery(string entityName, DataSeedDiContainer container, DatabaseEntityTracker tracker) : base(container, tracker)
 {
     this.EntityName = entityName;
 }
Beispiel #8
0
 public LeaveTypeQuery(string entityName, DataSeedDiContainer container, DatabaseEntityTracker tracker) : base(entityName, container, tracker)
 {
 }
Beispiel #9
0
 public Seeder(DataSeedDiContainer container, DatabaseEntityTracker tracker)
 {
     this.Container = container;
     this.Tracker   = tracker;
 }
Beispiel #10
0
 public ActivityQuery(string entityName, DataSeedDiContainer container, DatabaseEntityTracker tracker) : base(entityName, container, tracker)
 {
 }