Exemplo n.º 1
0
        public async Task CanGetGroupedFeatureDescriptions_DoesNotReturnSameFeatureIfMultipleVersionsExist()
        {
            // Arrange
            var documentStoreProvider = DocumentStoreProvider;
            await documentStoreProvider.Store.ExecuteIndexAsync(new Features_ByTitleProductAndGroup());

            using (var session = documentStoreProvider.Store.OpenAsyncSession())
            {
                await session.StoreDbFeatureAsync("MyProduct", "Group1", "MyFirstFeature", "0.0.0");

                await session.StoreDbFeatureAsync("MyProduct", "Group1", "MyFirstFeature", "1.0.0");

                await session.SaveChangesAsync();
            }

            WaitForIndexing(documentStoreProvider.Store);

            // Act
            var sut    = new FeatureManager(documentStoreProvider, configurationManager, logger);
            var result = await sut.GetGroupedFeatureDescriptionsAsync("MyProduct");

            // Assert
            result.ShouldNotBeNull();
            result.Count().ShouldBe(1);

            var firstGroup = result.FirstOrDefault();

            firstGroup.ShouldNotBeNull();
            firstGroup.Features.Count().ShouldBe(1);
            firstGroup.Features.FirstOrDefault()?.Title.ShouldBe("MyFirstFeature");
        }
Exemplo n.º 2
0
        public async Task CanGetGroupedFeatureDescriptions()
        {
            // Arrange
            var documentStoreProvider = DocumentStoreProvider;

            await documentStoreProvider.StoreDbFeatureAsync("MyProduct", "Group1", "MyFirstFeature", "0.0.0");

            await documentStoreProvider.StoreDbFeatureAsync("MyProduct", "Group1", "MySecondFeature", "0.0.0");

            await documentStoreProvider.StoreDbFeatureAsync("MyProduct", "Group2", "MyOtherFeature", "0.0.0");

            WaitForIndexing(documentStoreProvider.Store);

            // Act
            var sut    = new FeatureManager(documentStoreProvider, logger);
            var result = await sut.GetGroupedFeatureDescriptionsAsync("MyProduct");

            // Assert
            result.ShouldNotBeNull();
            result.Count().ShouldBe(2);

            var firstGroup = result.FirstOrDefault();

            firstGroup.ShouldNotBeNull();
            firstGroup.Features.Count().ShouldBe(2);
            firstGroup.Features.FirstOrDefault()?.Title.ShouldBe("MyFirstFeature");
            firstGroup.Features.LastOrDefault()?.Title.ShouldBe("MySecondFeature");

            var secondGroup = result.LastOrDefault();

            secondGroup.ShouldNotBeNull();
            secondGroup.Features.Count().ShouldBe(1);
            secondGroup.Features.FirstOrDefault()?.Title.ShouldBe("MyOtherFeature");
        }
Exemplo n.º 3
0
        public async Task CanGetGroupedFeatureDescriptions_DoesNotReturnSameFeatureIfMultipleVersionsExist()
        {
            // Arrange
            var documentStoreProvider = DocumentStoreProvider;

            await documentStoreProvider.StoreDbFeatureAsync("MyProduct", "Group1", "MyFirstFeature", "0.0.0");

            await documentStoreProvider.StoreDbFeatureAsync("MyProduct", "Group1", "MyFirstFeature", "1.0.0");

            WaitForIndexing(documentStoreProvider.Store);

            // Act
            var sut    = new FeatureManager(documentStoreProvider, logger);
            var result = await sut.GetGroupedFeatureDescriptionsAsync("MyProduct");

            // Assert
            result.ShouldNotBeNull();
            result.Count().ShouldBe(1);

            var firstGroup = result.FirstOrDefault();

            firstGroup.ShouldNotBeNull();
            firstGroup.Features.Count().ShouldBe(1);
            firstGroup.Features.FirstOrDefault()?.Title.ShouldBe("MyFirstFeature");
        }
Exemplo n.º 4
0
 public async Task <IEnumerable <Group> > GetGroupsAsync(string productName)
 {
     return(await _featureManager.GetGroupedFeatureDescriptionsAsync(productName));
 }
Exemplo n.º 5
0
 public async Task <IEnumerable <Group> > GetAsync(string branchName)
 {
     // NOTE: Using the branchName as product name because of backwards compatability
     return(await _featureManager.GetGroupedFeatureDescriptionsAsync(branchName));
 }