public void ForExistingEmptyProductFileProductIsReportedAsConfigured()
 {
     using (var helper = new ProductConfigurationHelper("Product.Empty.json"))
     {
         helper.Configuration.IsProductConfigured.Should().BeTrue();
     }
 }
        public void ProductWithPackagesIsParsed()
        {
            using (var helper = new ProductConfigurationHelper("Product.PackagesOnly.json"))
            {
                helper.Configuration.IsProductConfigured.Should().BeTrue();
                var packages = helper.Configuration.GetPackages().FlattenLeastDependentFirst().ToArray();

                packages.Length.Should().Be(2);
                packages[0].ToString().Should().Be("ABC/1.0");
                packages[1].ToString().Should().Be("XYZ/2.0");
            }
        }
        public void ProductWithPackagesIsParsed()
        {
            using (var helper = new ProductConfigurationHelper("Product.PackagesOnly.json"))
            {
                helper.Configuration.IsProductConfigured.Should().BeTrue();
                var packages = helper.Configuration.GetPackageConfigurations(DependencyOrdering.BottomToTop).ToList();

                packages.Count.Should().Be(2);
                packages[0].Id.ToString().Should().Be("ABC/1.0");
                packages[1].Id.ToString().Should().Be("XYZ/2.0");
            }
        }
        public void ProductWithAllFeaturesIsParsed()
        {
            using (var helper = new ProductConfigurationHelper("Product.json"))
            {
                helper.Configuration.IsProductConfigured.Should().BeTrue();
                var packages = helper.Configuration.GetPackageConfigurations(DependencyOrdering.BottomToTop).ToList();

                packages.Count.Should().Be(3);
                packages[0].Id.ToString().Should().Be("ABC/1.0");
                packages[0].IsPackageEnabled.Should().BeTrue();

                packages[1].Id.ToString().Should().Be("XYZ/2.0");
                packages[1].GetPackageActivationMode().Should().Be(EntityActivationMode.Deferred);

                packages[2].Id.ToString().Should().Be("QQQ/3.0");

                var files = helper.Configuration.GetInstalledFiles(new PackageId("XYZ/2.0"), true);
                files.Count().Should().Be(2);
            }
        }
        public void ProductWithAllFeaturesIsParsed()
        {
            using (var helper = new ProductConfigurationHelper("Product.json"))
            {
                helper.Configuration.IsProductConfigured.Should().BeTrue();
                var packages = helper.Configuration.GetPackages().FlattenLeastDependentFirst().ToArray();

                packages.Length.Should().Be(3);
                packages[0].ToString().Should().Be("ABC/1.0");

                var config = helper.Configuration.GetPackageConfiguration(packages[0]);
                config.IsPackageEnabled.Should().BeTrue();

                packages[1].ToString().Should().Be("QQQ/3.0");

                packages[2].ToString().Should().Be("XYZ/2.0");
                config = helper.Configuration.GetPackageConfiguration(packages[2]);
                config.GetPackageActivationMode().Should().Be(EntityActivationMode.Deferred);

                var files = helper.Configuration.GetInstalledFiles(new PackageId("XYZ/2.0"), true);
                files.Count.Should().Be(2);
            }
        }