public async Task ShouldReadCapabilitiesWithFrameworksCorrectlyOrderedByName()
        {
            var capabilityEntities = new List <CapabilityEntity>
            {
                CapabilityEntityBuilder.Create().WithName("Bravo").Build(),
                CapabilityEntityBuilder.Create().WithName("Alpha").Build(),
                CapabilityEntityBuilder.Create().WithName("Delta").Build(),
                CapabilityEntityBuilder.Create().WithName("Charlie").Build()
            };

            foreach (var capabilityEntity in capabilityEntities)
            {
                await capabilityEntity.InsertAsync().ConfigureAwait(false);
            }

            await FrameworkCapabilitiesEntityBuilder.Create().WithCapabilityId(capabilityEntities.First(c => c.Name == "Charlie").Id).WithIsFoundation(true).Build().InsertAsync().ConfigureAwait(false);

            await FrameworkCapabilitiesEntityBuilder.Create().WithCapabilityId(capabilityEntities.First(c => c.Name == "Delta").Id).WithIsFoundation(true).Build().InsertAsync().ConfigureAwait(false);

            var capabilities = (await _capabilityRepository.ListAsync(new CancellationToken()).ConfigureAwait(false)).ToList();

            Assert.That(capabilities[0].Name, Is.EqualTo("Alpha"));
            Assert.That(capabilities[1].Name, Is.EqualTo("Bravo"));
            Assert.That(capabilities[2].Name, Is.EqualTo("Charlie"));
            Assert.That(capabilities[3].Name, Is.EqualTo("Delta"));
        }
        public async Task ShouldReadCapabilitiesWithFrameworks()
        {
            var capabilityEntities = new List <CapabilityEntity>
            {
                CapabilityEntityBuilder.Create().WithName("Cap1").Build(),
                CapabilityEntityBuilder.Create().WithName("Cap2").Build(),
                CapabilityEntityBuilder.Create().WithName("Cap3").Build()
            };

            foreach (var capabilityEntity in capabilityEntities)
            {
                await capabilityEntity.InsertAsync().ConfigureAwait(false);
            }

            await FrameworkCapabilitiesEntityBuilder.Create().WithCapabilityId(capabilityEntities.First(c => c.Name == "Cap1").Id).WithIsFoundation(false).Build().InsertAsync().ConfigureAwait(false);

            await FrameworkCapabilitiesEntityBuilder.Create().WithCapabilityId(capabilityEntities.First(c => c.Name == "Cap2").Id).WithIsFoundation(true).Build().InsertAsync().ConfigureAwait(false);

            var capabilities = await _capabilityRepository.ListAsync(new CancellationToken()).ConfigureAwait(false);

            capabilities.Should().BeEquivalentTo(capabilityEntities.Select(ce => new
            {
                CapabilityReference = ce.CapabilityRef,
                ce.Version,
                ce.Name,
                IsFoundation = (ce.Name == "Cap2")
            }));
        }
Example #3
0
        private static async Task InsertCapabilityAsync(CapabilityTable capabilityTable)
        {
            var capability = CapabilityEntityBuilder.Create().WithName(capabilityTable.CapabilityName).Build();
            await capability.InsertAsync().ConfigureAwait(false);

            await FrameworkCapabilitiesEntityBuilder.Create().WithCapabilityId(capability.Id).WithIsFoundation(capabilityTable.IsFoundation).Build().InsertAsync().ConfigureAwait(false);
        }
Example #4
0
        private static async Task InsertCapabilityAsync(CapabilityTable capabilityTable)
        {
            var capability = CapabilityEntityBuilder.Create()
                             .WithName(capabilityTable.CapabilityName)
                             .WithCapabilityRef(capabilityTable.CapabilityRef)
                             .WithVersion(capabilityTable.Version)
                             .WithDescription(capabilityTable.Description)
                             .WithSourceUrl(capabilityTable.SourceUrl)
                             .WithCategoryId(capabilityTable.CategoryId)
                             .Build();
            await capability.InsertAsync();

            await FrameworkCapabilitiesEntityBuilder.Create()
            .WithCapabilityId(capability.Id)
            .WithIsFoundation(capabilityTable.IsFoundation)
            .Build()
            .InsertAsync();
        }
        public async Task ShouldReadGPITFuturesCapabilitiesWithFrameworksCorrectlyOrderedByName()
        {
            var capabilityEntities = new List <CapabilityEntity>
            {
                CapabilityEntityBuilder.Create().WithName("Bravo").WithCategoryId(1).Build(),
                CapabilityEntityBuilder.Create().WithName("Alpha").WithCategoryId(1).Build(),
                CapabilityEntityBuilder.Create().WithName("Delta").WithCategoryId(1).Build(),
                CapabilityEntityBuilder.Create().WithName("Charlie").WithCategoryId(1).Build(),
            };

            foreach (var capabilityEntity in capabilityEntities)
            {
                await capabilityEntity.InsertAsync();
            }

            foreach (var entity in new List <CapabilityEntity>
            {
                CapabilityEntityBuilder.Create().WithName("Echo").WithCategoryId(3).Build(),
                CapabilityEntityBuilder.Create().WithName("FoxTrot").WithCategoryId(0).Build(),
                CapabilityEntityBuilder.Create().WithName("Golf").WithCategoryId(2).Build(),
            })
            {
                await entity.InsertAsync();
            }

            await FrameworkCapabilitiesEntityBuilder.Create()
            .WithCapabilityId(capabilityEntities.First(c => c.Name == "Charlie").Id)
            .WithIsFoundation(true)
            .Build()
            .InsertAsync();

            await FrameworkCapabilitiesEntityBuilder.Create()
            .WithCapabilityId(capabilityEntities.First(c => c.Name == "Delta").Id)
            .WithIsFoundation(true)
            .Build()
            .InsertAsync();

            var capabilities = (await capabilityRepository.ListAsync(CancellationToken.None)).ToList();

            Assert.That(capabilities[0].Name, Is.EqualTo("Alpha"));
            Assert.That(capabilities[1].Name, Is.EqualTo("Bravo"));
            Assert.That(capabilities[2].Name, Is.EqualTo("Charlie"));
            Assert.That(capabilities[3].Name, Is.EqualTo("Delta"));
        }