public async Task CategoryExistsReturnsFalseIfCategoryDoesntExists() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var repository = new EfDeletableEntityRepository <Category>(dbContext); var service = new CategoriesService(repository); var category = new Category() { Id = 1, }; dbContext.Add(category); await dbContext.SaveChangesAsync(); var result = service.CategoryExists(2); Assert.False(result); }