public async Task ExistsAsync_WithDifferentManufacturer_ReturnsFalse() { // Arrange const string testName = "TestName"; var context = new PoolItDbContext(new DbContextOptionsBuilder <PoolItDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); var manufacturer = new CarManufacturer { Name = "TestManufacturer" }; context.CarModels.AddRange( new CarModel { Model = testName, Manufacturer = new CarManufacturer { Name = "OtherManufacturer" } }, new CarModel { Model = "OtherModel", Manufacturer = manufacturer }); context.SaveChanges(); var modelsService = new ModelsService(new EfRepository <CarModel>(context)); var serviceModel = new CarModelServiceModel { Model = testName, ManufacturerId = manufacturer.Id }; // Act var result = await modelsService.ExistsAsync(serviceModel); // Assert Assert.False(result); }