public ItemService(medikeepContext context,
                    ItemValidator val, IMapper mapper)
 {
     _context   = context;
     _validator = val;
     _mapper    = mapper;
 }
 public void Setup()
 {
     mapper    = BaseTest.GetMapper();
     context   = BaseTest.GetContext();
     validator = BaseTest.GetValidator();
     service   = new ItemService(context, validator, mapper);
 }
示例#3
0
        public static void Setup(TestContext tc)
        {
            //build startup pipeline for test
            var webHost = Microsoft.AspNetCore.WebHost.CreateDefaultBuilder()
                          .UseStartup <TestStartup>().Build();

            mapper = webHost.Services.GetService(typeof(IMapper)) as IMapper;
            //seed data for item entity
            validator = webHost.Services.GetService(typeof(ItemValidator)) as ItemValidator;
            fakes     = new DatabaseContextFake();
            dbContext = fakes.GetDatabaseItemContext();
        }
示例#4
0
        public medikeepContext GetDatabaseItemContext()
        {
            var options = new DbContextOptionsBuilder <medikeepContext>()
                          .UseSqlite("Filename= test.db")
                          .Options;
            var databaseContext = new medikeepContext(options);

            databaseContext.Database.EnsureCreated();

            //seeding
            databaseContext.AddRange(GetMockData());
            return(databaseContext);
        }
        public void Context_for_MediKeep_Should_exist()
        {
            var context = new medikeepContext();

            Assert.IsNotNull(context);
        }