public async Task EmptySupplierResultReturnsDefaultSupplier() { solutionSupplierResult = Mock.Of <ISolutionSupplierResult>(r => r.SolutionId == _solutionId && r.Name == null && r.Summary == null && r.Url == null ); var supplier = await _context.GetSupplierBySolutionIdHandler.Handle( new GetSupplierBySolutionIdQuery(_solutionId), _cancellationToken).ConfigureAwait(false); supplier.Should().NotBeNull(); supplier.Should().BeEquivalentTo(new SolutionSupplierDto()); }
/// <summary> /// Initialises a new instance of the <see cref="Solution" /> class. /// </summary> internal Solution( ISolutionResult solutionResult, IEnumerable <ISolutionCapabilityListResult> solutionCapabilityListResult, IEnumerable <IMarketingContactResult> contactResult, ISolutionSupplierResult solutionSupplierResult, IDocumentResult documentResult, IEnumerable <ISolutionEpicListResult> solutionEpicListResults) { var contactResultList = contactResult.ToList(); var solutionEpicsByCapability = solutionEpicListResults?.ToLookup(e => e.CapabilityId); Id = solutionResult.Id; Name = solutionResult.Name; LastUpdated = GetLatestLastUpdated(solutionResult, contactResultList); Summary = solutionResult.Summary; Description = solutionResult.Description; Features = string.IsNullOrWhiteSpace(solutionResult.Features) ? new List <string>() : JsonConvert.DeserializeObject <IEnumerable <string> >(solutionResult.Features); Integrations = new Integrations { Url = solutionResult.IntegrationsUrl, DocumentName = documentResult?.IntegrationDocumentName }; ImplementationTimescales = new ImplementationTimescales { Description = solutionResult.ImplementationTimescales }; AboutUrl = solutionResult.AboutUrl; RoadMap = new RoadMap { Summary = solutionResult.RoadMap, DocumentName = documentResult?.RoadMapDocumentName }; ClientApplication = string.IsNullOrWhiteSpace(solutionResult.ClientApplication) ? new ClientApplication() : JsonConvert.DeserializeObject <ClientApplication>(solutionResult.ClientApplication); IsFoundation = solutionResult.IsFoundation; Capabilities = solutionCapabilityListResult.Select(c => new ClaimedCapability(c, solutionEpicsByCapability?[c.CapabilityId])); Contacts = contactResultList.Select(c => new Contact(c)); PublishedStatus = solutionResult.PublishedStatus; Hosting = string.IsNullOrWhiteSpace(solutionResult.Hosting) ? new Hosting() : JsonConvert.DeserializeObject <Hosting>(solutionResult.Hosting); Supplier = solutionSupplierResult != null ? new SolutionSupplier(solutionSupplierResult) : new SolutionSupplier(); SolutionDocument = new SolutionDocument(documentResult?.SolutionDocumentName); }
public async Task EmptySupplierResultReturnsDefaultSupplier() { Expression <Func <ISolutionSupplierResult, bool> > resultExpression = r => r.SolutionId == solutionId && r.Name == null && r.Summary == null && r.Url == null; solutionSupplierResult = Mock.Of(resultExpression); var supplier = await context.GetSupplierBySolutionIdHandler.Handle( new GetSupplierBySolutionIdQuery(solutionId), cancellationToken); supplier.Should().NotBeNull(); supplier.Should().BeEquivalentTo(new SolutionSupplierDto()); }
public async Task ShouldGetAboutSupplierById() { var originalSupplier = new SolutionSupplier { Name = "Some name", Summary = "Some Summary", Url = "Some Url" }; solutionSupplierResult = Mock.Of <ISolutionSupplierResult>(r => r.SolutionId == _solutionId && r.Name == originalSupplier.Name && r.Summary == originalSupplier.Summary && r.Url == originalSupplier.Url ); var newSupplier = await _context.GetSupplierBySolutionIdHandler.Handle( new GetSupplierBySolutionIdQuery(_solutionId), _cancellationToken).ConfigureAwait(false); newSupplier.Should().BeEquivalentTo(originalSupplier); }
public async Task ShouldGetAboutSupplierById() { var originalSupplier = new SolutionSupplier { Name = "Some name", Summary = "Some Summary", Url = "Some Url", }; Expression <Func <ISolutionSupplierResult, bool> > resultExpression = r => r.SolutionId == solutionId && r.Name == originalSupplier.Name && r.Summary == originalSupplier.Summary && r.Url == originalSupplier.Url; solutionSupplierResult = Mock.Of(resultExpression); var newSupplier = await context.GetSupplierBySolutionIdHandler.Handle( new GetSupplierBySolutionIdQuery(solutionId), cancellationToken); newSupplier.Should().BeEquivalentTo(originalSupplier); }
internal SolutionSupplier(ISolutionSupplierResult solutionSupplierResult) { Name = solutionSupplierResult.Name; Summary = solutionSupplierResult.Summary; Url = solutionSupplierResult.Url; }