public async Task ValidateDataset_GivenViewModelButResponseIsBadRequest_ReturnsStatusCode400()
        {
            // Arrange
            ValidateDatasetModel viewModel = new ValidateDatasetModel();

            ValidatedApiResponse <DatasetValidationStatusModel> response = new ValidatedApiResponse <DatasetValidationStatusModel>(HttpStatusCode.BadRequest);

            response.ModelState = new Dictionary <string, IEnumerable <string> >();

            IDatasetsApiClient apiClient = CreateApiClient();

            apiClient
            .ValidateDataset(Arg.Is(viewModel))
            .Returns(response);

            ILogger logger = CreateLogger();

            DatasetController controller = CreateController(apiClient, logger);

            // Act
            IActionResult result = await controller.ValidateDataset(viewModel);

            // Assert
            result
            .Should()
            .BeOfType <InternalServerErrorResult>();

            logger
            .Received(1)
            .Warning(Arg.Is("Failed to validate dataset with status code: {statusCode}"), Arg.Is(HttpStatusCode.BadRequest));
        }
        public void ValidateDatasett_GivenViewModelIsNull_ThowsArgumentNullException()
        {
            // Arrange
            ValidateDatasetModel viewModel = null;

            DatasetController controller = CreateController();

            // Act
            Func <Task> test = async() => await controller.ValidateDataset(viewModel);

            // Assert
            test
            .Should()
            .ThrowExactly <ArgumentNullException>();
        }
        public async Task ValidateDataset_GivenViewModelAndResponseIsSuccess_ReturnsStatusModel()
        {
            // Arrange
            ValidateDatasetModel viewModel = new ValidateDatasetModel();


            DatasetValidationStatusModel statusModel = new DatasetValidationStatusModel()
            {
                ValidationFailures = new Dictionary <string, IEnumerable <string> >(),
                CurrentOperation   = DatasetValidationStatusOperation.Processing,
                DatasetId          = "datasetId",
                ErrorMessage       = "errorMessage",
                OperationId        = "operationId",
            };

            ValidatedApiResponse <DatasetValidationStatusModel> response = new ValidatedApiResponse <DatasetValidationStatusModel>(HttpStatusCode.OK, statusModel);

            DatasetValidationStatusViewModel resultViewModel = new DatasetValidationStatusViewModel()
            {
                ValidationFailures = new Dictionary <string, IEnumerable <string> >(),
                CurrentOperation   = DatasetValidationStatusOperationViewModel.Processing,
                DatasetId          = "datasetId",
                ErrorMessage       = "errorMessage",
                OperationId        = "operationId",
            };

            IDatasetsApiClient apiClient = CreateApiClient();

            apiClient
            .ValidateDataset(Arg.Is(viewModel))
            .Returns(response);

            ILogger logger = CreateLogger();

            DatasetController controller = CreateController(apiClient, logger);

            // Act
            IActionResult result = await controller.ValidateDataset(viewModel);

            // Assert
            result
            .Should()
            .BeOfType <OkObjectResult>()
            .Which
            .Value
            .Should()
            .BeEquivalentTo(resultViewModel);
        }