Ejemplo n.º 1
0
        /*
         * Private constructor. Only Instance function can call it.
         */
        private SingletonTestSetup()
        {
            // setup the local db for the system testing
            var serviceProvider = new ServiceCollection()
                                  .AddEntityFrameworkSqlServer()
                                  .BuildServiceProvider();

            // setup builder and point to the local db
            var builder = new DbContextOptionsBuilder <EndlasNetDbContext>();

            builder.UseSqlServer(connectionString, b => b.MigrationsAssembly("EndlasNet.Data"));
            _context = new EndlasNetDbContext(builder.Options);
            _context.Database.Migrate();
        }
Ejemplo n.º 2
0
            public void Setup()
            {
                _db  = SingletonTestSetup.Instance().Get();
                repo = new Repo(_db);

                powderInfo = new StaticPowderInfo
                {
                    StaticPowderInfoId = Guid.NewGuid(),
                    EndlasDescription  = "TestPowder",
                    Density            = 1f,
                };
                _db.StaticPowderInfo.Add(powderInfo);
                _db.SaveChanges();

                vendor = new Vendor
                {
                    VendorId       = Guid.NewGuid(),
                    VendorName     = "Name",
                    PointOfContact = "POC",
                    VendorAddress  = "Address",
                    VendorPhone    = "Phone"
                };
                _db.Vendors.Add(vendor);
                _db.SaveChanges();

                powderOrderGood = new PowderOrder
                {
                    PowderOrderId     = Guid.NewGuid(),
                    PurchaseOrderDate = DateTime.Now,
                    PurchaseOrderNum  = "",
                    ShippingCost      = 0.0f,
                    TaxCost           = 0.0f,
                    Vendor            = vendor,
                    VendorId          = vendor.VendorId,
                };
                _db.PowderOrders.Add(powderOrderGood);

                powderOrderBad = new PowderOrder
                {
                    PowderOrderId     = Guid.NewGuid(),
                    PurchaseOrderDate = DateTime.Now,
                    PurchaseOrderNum  = "",
                    ShippingCost      = 0.0f,
                    TaxCost           = 0.0f,
                    Vendor            = vendor,
                    VendorId          = vendor.VendorId,
                };
                _db.PowderOrders.Add(powderOrderBad);
                _db.SaveChanges();
            }
 public EnvironmentalSnapshotsController(EndlasNetDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 4
0
 public void Setup()
 {
     _db = SingletonTestSetup.Instance().Get();
 }