private BepwayContext GetContext() { ConfigurationHelper helper = new ConfigurationHelper("secrets.json"); DbContextOptionsBuilder builder = new DbContextOptionsBuilder(); DbContextOptions /*<BepwayContext>*/ options = /*(DbContextOptions<BepwayContext>)*/ builder.UseSqlServer(helper.Get("BepwayConnectionString")).Options; _context = new BepwayContext(options); return(_context); }
public async Task ShouldThrowDbConcurrency() { // Arrange BepwayContext context1 = GetContext(); BepwayContext context2 = GetContext(); BepwayContext testContext; Company company1 = await context1.Company.OrderBy(c => c.Id).FirstAsync(); Company company2 = await context2.Company.OrderBy(c => c.Id).FirstAsync(); Company customerAfterUpdate; // Act company2.ImageUrl = "https://coucou.com"; await context2.SaveChangesAsync(); company1.ImageUrl = "https://coucou.be"; // Assert Assert.ThrowsException <DbUpdateConcurrencyException>(() => context1.SaveChanges()); testContext = GetContext(); customerAfterUpdate = await testContext.Company.FindAsync(company1.Id); Assert.AreEqual("https://coucou.com", customerAfterUpdate.ImageUrl); }
public UserController(BepwayContext context, IMapper mapper) { Context = context; Mapper = mapper; dataAccess = new UserDataAccess(Context); }
public PasswordController(BepwayContext context) { Context = context; dataAccess = new UserDataAccess(Context); }
public JwtController(IOptions <JwtIssuerOptions> jwtOptions, BepwayContext context) { Context = context; _jwtOptions = jwtOptions.Value; }
public ZoningController(BepwayContext context, IMapper mapper) { Context = context; Mapper = mapper; dataAccess = new ZoningDataAccess(Context); }
public CompanyController(BepwayContext context, IMapper mapper) { Context = context; Mapper = mapper; dataAccess = new CompanyDataAccess(Context); }