예제 #1
0
        public Startup()
        {
            var dbContextOptionsBuilder = new DbContextOptionsBuilder <PorwalGeneralStoreContext>()
                                          .UseInMemoryDatabase(databaseName: "PorwalGeneralStore")
                                          .EnableSensitiveDataLogging(true)
                                          .Options;

            _inMemoryContext = new PorwalGeneralStoreContext(dbContextOptionsBuilder);
            SeedingTestData();
        }
예제 #2
0
        public void UnitTest4(SignUpForm input)
        {
            startup = new Startup("PorwalGeneralStore_RegisterUser_DB", false);
            _porwalGeneralStoreContext = startup._inMemoryContext;
            _userLayer = new UserLayer(_porwalGeneralStoreContext);
            var ActualResult   = _userLayer.RegisterUser(input);
            var ExpectedResult = _porwalGeneralStoreContext
                                 .CustomerInfo
                                 .Any(x => x.Phone.Equals(input.MobileNumber, StringComparison.OrdinalIgnoreCase));

            Assert.True(ActualResult);
            Assert.True(ExpectedResult);
        }
예제 #3
0
        public Startup(string dbName, bool isSeedData = true)
        {
            var dbContextOptionsBuilder = new DbContextOptionsBuilder <PorwalGeneralStoreContext>()
                                          .UseInMemoryDatabase(databaseName: dbName)
                                          .EnableSensitiveDataLogging(true)
                                          .Options;

            _inMemoryContext = new PorwalGeneralStoreContext(dbContextOptionsBuilder);
            if (isSeedData)
            {
                SeedingTestData();
            }
        }
예제 #4
0
 public OrderLayer(PorwalGeneralStoreContext _context)
 {
     context = _context;
 }
 public ProductLayer(PorwalGeneralStoreContext _context)
 {
     context = _context;
 }
예제 #6
0
 public UserDataAccessLayerUnitTest()
 {
     startup = new Startup();
     _porwalGeneralStoreContext = startup._inMemoryContext;
     _userLayer = new UserLayer(_porwalGeneralStoreContext);
 }
 public ProductDataAccessLayerUnitTest()
 {
     startup = new Startup();
     _porwalGeneralStoreContext = startup._inMemoryContext;
     _productLayer = new ProductLayer(_porwalGeneralStoreContext);
 }