Example #1
0
 public UserRepositoryTest(DatabaseFixture fixture)
 {
     _fixture        = fixture;
     _context        = _fixture.CreateContext();
     _userRepository = new UserRepository(_context);
     TestDataInitializer.ClearData(_context);
 }
Example #2
0
        private async Task PrepareDatabase()
        {
            _context = _fixture.CreateContext();
            await _context.Database.EnsureDeletedAsync();

            await _context.Database.EnsureCreatedAsync();
        }
Example #3
0
        public PostServiceIntegrationTest(DatabaseFixture fixture)
        {
            _fixture        = fixture;
            _context        = _fixture.CreateContext();
            _postRepository = new PostRepository(_context);
            TestDataInitializer.ClearData(_context);

            _unitOfWork      = new Mock <IUnitOfWork>();
            _userContextMock = new Mock <IUserContext>();
            _fileServiceMock = new Mock <IFileService>();
            _commentService  = new Mock <ICommentService>();
            _postOptions     = new Mock <IOptionsSnapshot <PostConfig> >();
            _batchOptions    = new Mock <IOptionsSnapshot <FullscreenBatchConfig> >();

            _postService = new PostService(_unitOfWork.Object, _fileServiceMock.Object, _commentService.Object, _userContextMock.Object,
                                           _batchOptions.Object, _postOptions.Object);
            _unitOfWork.SetupGet(x => x.Posts).Returns(_postRepository);

            _batchOptions.SetupProperty(bo => bo.Value.FullscreenBatchSize, 4);

            //_batchOptions.Object.Value.FullscreenBatchSize = 4;
        }