public async Task ShouldRetrieveHostingDetailsWhenPresent() { const string expectedHostingString = "I am the hosting string"; await CatalogueItemEntityBuilder .Create() .WithCatalogueItemId(_solution1Id) .WithName(_solution1Id) .WithPublishedStatusId((int)PublishedStatus.Published) .WithSupplierId(_supplierId) .Build() .InsertAsync(); await SolutionEntityBuilder.Create() .WithId(_solution1Id) .Build() .InsertAsync(); await SolutionDetailEntityBuilder.Create() .WithHosting(expectedHostingString) .Build() .InsertAndSetCurrentForSolutionAsync(); var result = await _solutionDetailRepository.GetHostingBySolutionIdAsync(_solution1Id, new CancellationToken()); result.Hosting.Should().Be(expectedHostingString); }
public async Task <Hosting> BySolutionIdAsync(string id, CancellationToken cancellationToken) { var hostingResult = await _solutionDetailRepository.GetHostingBySolutionIdAsync(id, cancellationToken).ConfigureAwait(false) ?? throw new NotFoundException(nameof(Solution), id); return(string.IsNullOrWhiteSpace(hostingResult.Hosting) ? new Hosting() : JsonConvert.DeserializeObject <Hosting>(hostingResult.Hosting)); }