public async Task NotSupported() { // Arrange // Act using (var dbContext = new MvpDbContext(_dbConnection, true)) { await dbContext.MyEntities .Select(x => x.Date) .SingleAsync(); } // Assert // See ExpectedExceptionAttribute }
public async Task CountEntities() { // Arrange _data.Table <MyEntity>().Add(new MyEntity { Id = 1, Name = "Test", Date = new LocalDate(2019, 01, 28) }); var count = 0; // Act using (var dbContext = new MvpDbContext(_dbConnection, true)) { count = await dbContext.MyEntities .CountAsync(); } // Assert Assert.AreEqual(1, count); }
public async Task RetriveDate() { // Arrange _data.Table <MyEntity>().Add(new MyEntity { Id = 1, Name = "Test", Date = new LocalDate(2019, 01, 28) }); MyEntity myEntity = null; // Act using (var dbContext = new MvpDbContext(_dbConnection, true)) { myEntity = await dbContext.MyEntities .Where(x => x.Id == 1) .SingleAsync(); } // Assert Assert.AreEqual(new LocalDate(2019, 01, 28), myEntity.Date); }
public ProductRepository(MvpDbContext context) { _context = context; }
public Repository(MvpDbContext context) { _context = context; }
public Repository() { _context = new MvpDbContext(); }
public UserRepository(IMapper mapper, MvpDbContext context) { _mapper = mapper; _context = context; }