public async Task GetSpotByIdAsync_SpotExists_ShouldReturnTheSpot() { // Arrange expectedSpot.Region = fixture.Create <Region>(); spotId = expectedSpot.Id; context.Add(expectedSpot); context.SaveChanges(); //Act var actualSpot = await repository.GetSpotByIdAsync(spotId); //Assert Assert.AreEqual(expectedSpot, actualSpot); }
private async Task CheckSpotExists(int id) { var spot = await repository.GetSpotByIdAsync(id); if (spot == null) { throw new KeyNotFoundException("The spot doesn't exists."); } }