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

            _inMemoryContext = new PorwalGeneralStoreContext(dbContextOptionsBuilder);
            SeedingTestData();
        }
Exemple #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);
        }
        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();
            }
        }
Exemple #4
0
 public OrderLayer(PorwalGeneralStoreContext _context)
 {
     context = _context;
 }
 public ProductLayer(PorwalGeneralStoreContext _context)
 {
     context = _context;
 }
Exemple #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);
 }