public async Task GetDatasetAggregationsForSpecificationId_WhenSpeficationIdIsEmpty_ShouldThrowException() { // Arrange IDatasetsApiClient datasetsApiClient = Substitute.For <IDatasetsApiClient>(); IMapper mapper = CreateMapper(); DatasetAggregationsRepository datasetAggregationsRepository = new DatasetAggregationsRepository(datasetsApiClient, CreateMapper()); ArgumentNullException exception = null; // Act try { IEnumerable <DatasetAggregation> configuredTaskAwaiter = await datasetAggregationsRepository.GetDatasetAggregationsForSpecificationId(string.Empty); } catch (Exception e) { exception = e as ArgumentNullException; } // Assert exception.Should().NotBeNull(); exception.Should().BeOfType <ArgumentNullException>(); await datasetsApiClient.DidNotReceive().GetDatasetAggregationsBySpecificationId(Arg.Any <string>()); }