Пример #1
0
        public async Task CanDeleteFeatureByProductGroupAndTitle()
        {
            // Arrange
            var documentStoreProvider = DocumentStoreProvider;

            await documentStoreProvider.StoreDbFeatureAsync("MyProduct", "MyGroup", "My First Feature", "0.0.0");

            await documentStoreProvider.StoreDbFeatureAsync("MyProduct", "MyGroup", "My First Feature", "1.0.0");

            await documentStoreProvider.StoreDbFeatureAsync("MyProduct", "MyGroup", "My Second Feature", "0.0.0");

            WaitForIndexing(documentStoreProvider.Store);

            // Act
            var sut = new FeatureManager(documentStoreProvider, logger);
            await sut.DeleteFeatureAsync("MyProduct", "MyGroup", "My First Feature");

            WaitForIndexing(documentStoreProvider.Store);

            // Assert
            using (var session = documentStoreProvider.Store.OpenAsyncSession())
            {
                var features = await session.Query <DbFeature>().ToListAsync();

                features.ShouldNotBeNull();
                features.Count.ShouldBe(1);

                var remainingFeature = features.FirstOrDefault();
                remainingFeature.ShouldNotBeNull();
                remainingFeature.Title.ShouldBe("My Second Feature");
            }
        }
Пример #2
0
        public async Task CanDeleteFeatureByProductGroupTitleAndVersion()
        {
            // Arrange
            var documentStoreProvider = DocumentStoreProvider;

            using (var session = documentStoreProvider.Store.OpenAsyncSession())
            {
                await session.StoreDbFeatureAsync("MyProduct", "MyGroup", "My First Feature", "0.0.0");

                await session.StoreDbFeatureAsync("MyProduct", "MyGroup", "My First Feature", "1.0.0");

                await session.StoreDbFeatureAsync("MyProduct", "MyGroup", "My Second Feature", "0.0.0");

                await session.SaveChangesAsync();
            }

            // Act
            var sut = new FeatureManager(documentStoreProvider, configurationManager, logger);
            await sut.DeleteFeatureAsync("MyProduct", "MyGroup", "My First Feature", "0.0.0");

            // Assert
            using (var session = documentStoreProvider.Store.OpenAsyncSession())
            {
                var features = await session.Query <DbFeature>().ToListAsync();

                features.ShouldNotBeNull();
                features.Count.ShouldBe(2);

                var remainingFeature1 = features.FirstOrDefault();
                remainingFeature1.ShouldNotBeNull();
                remainingFeature1.Title.ShouldBe("My First Feature");
                remainingFeature1.Version.ShouldBe("1.0.0");

                var remainingFeature2 = features.LastOrDefault();
                remainingFeature2.ShouldNotBeNull();
                remainingFeature2.Title.ShouldBe("My Second Feature");
                remainingFeature2.Version.ShouldBe("0.0.0");
            }
        }
Пример #3
0
 public async Task DeleteAsync(string productName, string groupName, string title)
 {
     await _featureManager.DeleteFeatureAsync(productName, groupName, title);
 }
Пример #4
0
 public async Task DeleteAsync(string branchName, string groupName, string title)
 {
     await _featureManager.DeleteFeatureAsync(branchName, groupName, title, UNKNOWN_VERSION);
 }