Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public UserController(BepwayContext context, IMapper mapper)
 {
     Context    = context;
     Mapper     = mapper;
     dataAccess = new UserDataAccess(Context);
 }
Ejemplo n.º 4
0
 public PasswordController(BepwayContext context)
 {
     Context    = context;
     dataAccess = new UserDataAccess(Context);
 }
Ejemplo n.º 5
0
 public JwtController(IOptions <JwtIssuerOptions> jwtOptions, BepwayContext context)
 {
     Context     = context;
     _jwtOptions = jwtOptions.Value;
 }
Ejemplo n.º 6
0
 public ZoningController(BepwayContext context, IMapper mapper)
 {
     Context    = context;
     Mapper     = mapper;
     dataAccess = new ZoningDataAccess(Context);
 }
Ejemplo n.º 7
0
 public CompanyController(BepwayContext context, IMapper mapper)
 {
     Context    = context;
     Mapper     = mapper;
     dataAccess = new CompanyDataAccess(Context);
 }