public PostUnitTestController()
        {
            var context = new BlogDBContext(dbContextOptions);
            DummyDataDBInitializer db = new DummyDataDBInitializer();

            db.Seed(context);

            repository = new PostRepository(context);
        }
Exemple #2
0
        public PostUnitTestController()
        {
            dbContextOptions = new DbContextOptionsBuilder <BlogDBContext>()
                               .UseSqlServer(connectionString)
                               .Options;

            var context = new BlogDBContext(dbContextOptions);
            DummyDataDBInitializer db = new DummyDataDBInitializer();

            db.Seed(context);

            repository = new PostRepository(context);
        }
Exemple #3
0
        public PostUnitTestController()
        {
            var context = new BlogDBContext(dbContextOptions);
            DummyDataDBInitializer db = new DummyDataDBInitializer();

            db.Seed(context);

            var serviceProvider = new ServiceCollection()
                                  .AddLogging(config => config.AddLog4Net())
                                  .BuildServiceProvider();

            var factory = serviceProvider.GetService <ILoggerFactory>();

            logger             = factory.CreateLogger <PostController>();
            postRepository     = new PostRepository(context);
            postRepositoryMock = new Mock <IPostRepository>();
        }