コード例 #1
0
        public ControllerFixture()
        {
            var container = IocHelper.BuildContainer(Lifestyle.Singleton);

            container.Register(new AppSettings(), new LoggerSettings());

            var optionsBuilder = new DbContextOptionsBuilder <Context>();

            optionsBuilder.UseNpgsql(TestValues.TestDbConnectionString);
            var context = new Context(optionsBuilder.Options);

            context.Database.EnsureCreated();
            container.Register(() => context);


            Mediator = container.GetInstance <IMediator>();
            Context  = context;
        }