public async Task FetchCountryAsync_WithValidCountryId_ReturnsCountry() { using (DatabaseWrapper database = new DatabaseWrapper()) { // Arrange Guid countryId = new Guid("184E1785-26B4-4AE4-80D3-AE319B103ACB"); // ID for UK - England OrganisationDetailsDataAccess dataAccess = new OrganisationDetailsDataAccess(database.WeeeContext); // Act Domain.Country result = await dataAccess.FetchCountryAsync(countryId); // Assert Assert.NotNull(result); Assert.Equal(countryId, result.Id); Assert.Equal(result.Name, "UK - England"); } }
public async Task FetchCountryAsync_WithInvalidCountryId_ThrowsException() { using (DatabaseWrapper database = new DatabaseWrapper()) { // Arrange Guid countryId = new Guid("5840BF0B-0CAF-4AF9-9881-F22DB7720F98"); OrganisationDetailsDataAccess dataAccess = new OrganisationDetailsDataAccess(database.WeeeContext); // Act Func<Task<Domain.Country>> action = async () => await dataAccess.FetchCountryAsync(countryId); // Assert await Assert.ThrowsAsync<Exception>(action); } }