public void CheckIfAddCarAddsTheCar() { var dbContext = new AutomobileDbContext(); var service = new OfferService(dbContext); IFormFile file = new FormFile(new MemoryStream(Encoding.UTF8.GetBytes("This is a dummy file")), 0, 0, "Data", "dummy.txt"); service.AddCar(new AddCarViewModel() { Title = "Test", Make = "Audi", Model = "A3", Year = 2003, Price = 220, Condition = (Condition)Enum.Parse(typeof(Condition), "New"), Color = "black", SteeringWheelSide = 0, FuelType = (FuelType)Enum.Parse(typeof(FuelType), "Diesel"), HorsePower = 150, EngineSize = 1060, Gearbox = (Gearbox)Enum.Parse(typeof(Gearbox), "Automatic"), Doors = "2", Kilometers = 15000, ContactNumber = "03210320232", MainImageFile = file }, "e4bf2992-cc46-4ebb-baf2-667f245a3582"); var carOffersContainCar = dbContext.CarOffers.Any(x => x.Title == "Test"); Assert.True(carOffersContainCar); var mockCar = dbContext.CarOffers.FirstOrDefault(x => x.Title == "Test"); dbContext.CarOffers.Remove(mockCar); dbContext.SaveChanges(); }