public static async Task ThenSolutionsHaveTheFollowingDetails(Table table) { var expectedSolutionDetails = table.CreateSet <SolutionTable>().Select(m => new { m.SolutionId, AboutUrl = string.IsNullOrWhiteSpace(m.AboutUrl) ? null : m.AboutUrl, Features = string.IsNullOrWhiteSpace(m.Features) ? null : m.Features, Summary = string.IsNullOrWhiteSpace(m.SummaryDescription) ? null : m.SummaryDescription, FullDescription = string.IsNullOrWhiteSpace(m.FullDescription) ? null : m.FullDescription, RoadMap = string.IsNullOrWhiteSpace(m.RoadMap) ? null : m.RoadMap, IntegrationsUrl = string.IsNullOrWhiteSpace(m.IntegrationsUrl) ? null : m.IntegrationsUrl, ImplementationDetail = string.IsNullOrWhiteSpace(m.ImplementationDetail) ? null : m.ImplementationDetail, ClientApplication = string.IsNullOrWhiteSpace(m.ClientApplication) ? null : JToken.Parse(m.ClientApplication).ToString(), Hosting = string.IsNullOrWhiteSpace(m.Hosting) ? null : JToken.Parse(m.Hosting).ToString(), }); var solutionDetails = await SolutionEntity.FetchAllAsync(); solutionDetails.Select(m => new { m.SolutionId, m.AboutUrl, m.Features, m.Summary, m.FullDescription, m.RoadMap, m.IntegrationsUrl, m.ImplementationDetail, ClientApplication = string.IsNullOrWhiteSpace(m.ClientApplication) ? null : JToken.Parse(m.ClientApplication).ToString(), Hosting = string.IsNullOrWhiteSpace(m.Hosting) ? null : JToken.Parse(m.Hosting).ToString(), }).Should().BeEquivalentTo(expectedSolutionDetails); }
public static async Task ThenSolutionsExist(Table table) { var expectedSolutions = table.CreateSet <SolutionUpdatedTable>(); var solutions = await SolutionEntity.FetchAllAsync(); solutions.Select(s => new { SolutionId = s.SolutionId, SolutionName = s.Name, }).Should().BeEquivalentTo(expectedSolutions); }
public static async Task GivenSolutionsAreLinkedToCapabilities(Table table) { var solutions = await SolutionEntity.FetchAllAsync().ConfigureAwait(false); var capabilities = await CapabilityEntity.FetchAllAsync().ConfigureAwait(false); foreach (var solutionCapabilityTable in table.CreateSet <SolutionCapabilityTable>()) { await SolutionCapabilityEntityBuilder.Create() .WithSolutionId(solutions.First(s => s.Name == solutionCapabilityTable.Solution).Id) .WithCapabilityId(capabilities.First(s => s.Name == solutionCapabilityTable.Capability).Id) .Build() .InsertAsync() .ConfigureAwait(false); } }
public static async Task GivenSolutionsAreLinkedToCapabilities(Table table) { var solutions = (await SolutionEntity.FetchAllAsync()).ToDictionary(s => s.Name); var capabilities = (await CapabilityEntity.FetchAllAsync()).ToDictionary(c => c.Name); foreach (var solutionCapability in table.CreateSet <SolutionCapabilityTable>()) { if (!solutionCapability.Capability.Any()) { continue; } foreach (var capability in solutionCapability.Capability) { await SolutionCapabilityEntityBuilder.Create() .WithSolutionId(solutions[solutionCapability.Solution].SolutionId) .WithCapabilityId(capabilities[capability].Id) .WithStatusId(solutionCapability.Pass ? PassedSolutionCapabilityStatusId : FailedSolutionCapabilityStatusId) .Build() .InsertAsync(); } } }
public static async Task GivenASolutionSlnDoesNotExist(string solutionId) { var solutionList = await SolutionEntity.FetchAllAsync(); solutionList.Select(s => s.SolutionId).Should().NotContain(solutionId); }