public void DBContainsQueryShouldReturnFalseIfQueryIdNotInDB(int Id, bool useAsync) { //Arrange var options = new DbContextOptionsBuilder <Project2DBContext>() .UseInMemoryDatabase(databaseName: "StaticFilledQueryDB") .Options; bool result; QueryRepo qRepo; //Act using (var context = new Project2DBContext(options)) { qRepo = new QueryRepo(context); if (useAsync) { result = qRepo.DBContainsQueryAsync(Id).Result; } else { result = qRepo.DBContainsQuery(Id); } } //Assert Assert.False(result); }
public void DBContainsQueryShouldReturnFalseIfIfDBIsEmpty(int Id, bool useAsync) { //Arrange var options = new DbContextOptionsBuilder <Project2DBContext>() .UseInMemoryDatabase(databaseName: "EmptyQueryDB3") .Options; bool result; QueryRepo qRepo; //Act using (var context = new Project2DBContext(options)) { qRepo = new QueryRepo(context); if (useAsync) { result = qRepo.DBContainsQueryAsync(Id).Result; } else { result = qRepo.DBContainsQuery(Id); } } //If exception is throw, test will exit before reaching Assert //Assert Assert.False(result); }