public void GetUsersShouldNotThrowExceptionIfDBIsEmpty() { //Arrange var options = new DbContextOptionsBuilder <Project2DBContext>() .UseInMemoryDatabase(databaseName: "EmptyDB1") .Options; bool result = true; AppUserRepo uRepo; //Act using (var context = new Project2DBContext(options)) { uRepo = new AppUserRepo(context); try { uRepo.GetUsers(); } catch { result = false; } } //Assert Assert.True(result); }
public void GetUsersShouldReturnAListWithProperNumberOfUsers() { //Arrange var options = new DbContextOptionsBuilder <Project2DBContext>() .UseInMemoryDatabase(databaseName: "StaticFilledUserDB") .Options; AppUserRepo uRepo; List <AppUser> uList; //Act using (var context = new Project2DBContext(options)) { uRepo = new AppUserRepo(context); uList = uRepo.GetUsers().ToList(); } //Assert Assert.Equal(4, uList.Count); }