Exemplo n.º 1
0
        public PostRepositoryTests(MongoDbDatabaseFixture fixture) : base(fixture)
        {
            SeedDatabase();

            _uow            = ServiceProvider.GetService <IBlogUnitOfWork>();
            _postRepository = (PostRepository)_uow.Posts;
        }
Exemplo n.º 2
0
        public AuthorRepositoryTests(MongoDbDatabaseFixture fixture) : base(fixture)
        {
            SeedDatabase();

            var uow = ServiceProvider.GetService <IBlogUnitOfWork>();

            _repository = (AuthorRepository)uow.Authors;
        }
Exemplo n.º 3
0
        public SearchPostsQueryTests(MongoDbDatabaseFixture fixture) : base(fixture)
        {
            SeedDatabase();

            var uow           = ServiceProvider.GetRequiredService <IBlogUnitOfWork>();
            var options       = ServiceProvider.GetRequiredService <IOptionsSnapshot <PineBlogOptions> >();
            var postUrlHelper = ServiceProvider.GetRequiredService <PostUrlHelper>();
            var fileUrlHelper = ServiceProvider.GetRequiredService <FileUrlHelper>();

            searchPostsQueryHandler = new SearchPostsQuery.Handler(uow, options, postUrlHelper, fileUrlHelper);
        }
Exemplo n.º 4
0
        public SearchPostsQueryTests(MongoDbDatabaseFixture fixture) : base(fixture)
        {
            SeedDatabase();

            var uow           = ServiceProvider.GetRequiredService <IBlogUnitOfWork>();
            var options       = ServiceProvider.GetRequiredService <IOptionsSnapshot <PineBlogOptions> >();
            var postUrlHelper = ServiceProvider.GetRequiredService <PostUrlHelper>();
            var fileUrlHelper = ServiceProvider.GetRequiredService <FileUrlHelper>();

            var postRankerMock = new Mock <IPostRanker>();

            postRankerMock
            .Setup(m => m.Rank(It.IsAny <IEnumerable <Post> >(), It.IsAny <string>()))
            .Returns((IEnumerable <Post> posts, string _) => posts);

            searchPostsQueryHandler = new SearchPostsQuery.Handler(uow, postRankerMock.Object, options, postUrlHelper, fileUrlHelper);
        }
 public BlogSettingsRepositoryTests(MongoDbDatabaseFixture fixture) : base(fixture)
 {
     _uow = ServiceProvider.GetRequiredService <IBlogUnitOfWork>();
     _blogSettingsRepository = (BlogSettingsRepository)_uow.BlogSettings;
 }