public static FuhoDbContext Create()
        {
            var _dateTimeProvider   = new Mock <IDateTimeProvider>();
            var _currentUserService = new Mock <ICurrentUserService>();

            _dateTimeProvider.Setup(x => x.Now).Returns(DateTime.Now);
            _currentUserService.Setup(x => x.UserId).Returns("a56b856f-e009-4cfa-9f87-58f04f573617");

            var options = new DbContextOptionsBuilder <FuhoDbContext>()
                          .UseInMemoryDatabase("FuhoInMemoryDataBase")
                          .Options;

            var context = new FuhoDbContext(options, _dateTimeProvider.Object, _currentUserService.Object);

            context.Database.EnsureCreated();

            return(context);
        }
Example #2
0
 public CreateProductHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext     = fixture.FuhoDbContext;
     _fileSystemService = fixture.FileSystemService;
 }
 public GetAllCategoriesHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext = fixture.FuhoDbContext;
 }
 public CreateCommentHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext = fixture.FuhoDbContext;
 }
 public GetCommentByProductIdHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext = fixture.FuhoDbContext;
     _logger        = fixture.CreateLoggerMock <GetCategoryByIdHandler>();
 }
 public CreateCategoryHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext = fixture.FuhoDbContext;
     _mapper        = fixture.Mapper;
 }
Example #7
0
 public CommandTestBase()
 {
     _fuhoDbContext = FuhoContextFactory.Create();
 }
 public GetAllProductsHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext = fixture.FuhoDbContext;
 }
 public UpdateProductHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext     = fixture.FuhoDbContext;
     _fileSystemService = fixture.FileSystemService;
     _logger            = fixture.CreateLoggerMock <UpdateProductHandler>();
 }
Example #10
0
 public UpdateCategoryHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext = fixture.FuhoDbContext;
     _logger        = fixture.CreateLoggerMock <UpdateCategoryHandler>();
 }
        public static void Destroy(FuhoDbContext context)
        {
            context.Database.EnsureDeleted();

            context.Dispose();
        }
 public RemoveProductHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext = fixture.FuhoDbContext;
 }
Example #13
0
 public RemoveCategoryHandlerTest(QueryTestFixture fixture)
 {
     _fuhoDbContext = fixture.FuhoDbContext;
 }