Пример #1
0
 public async Task ThrowsOnNullPackageRepository()
 {
     var package = StubPackageFactory.CreatePackage("A", "1.0.0");
     await Assert.ThrowsAsync <ArgumentNullException>(
         "repository",
         () => package.VisualizeUpgradeableDependenciesAsync(null, _targetFramework));
 }
            public void ReleasePackageIsNotColoredNode()
            {
                var package = StubPackageFactory.CreatePackage("A", "1.0.0");

                _visualizer.Visualize(package, Enumerable.Empty <PackageUpgrade>());

                Assert.Null(_directedGraph.Nodes[0].Background);
            }
            public void AcceptsNullUpgrades()
            {
                var package = StubPackageFactory.CreatePackage("A", "1.0.0");

                _visualizer.Visualize(package, null);

                Assert.Single(_directedGraph.Nodes);
                Assert.Null(_directedGraph.Links);
            }
Пример #4
0
            public async Task UnkownUpgradeActionIsDarkGrayLink()
            {
                var package    = StubPackageFactory.CreatePackage("Exact", "1.0.0", StubPackageDependencyFactory.CreateExact("Dependency", "1.0.0"));
                var repository = StubSourceRepositoryFactory.Create(new[] { package, });

                var directedGraph = await new[] { package, }.VisualizeUpgradeableDependenciesAsync(repository, _targetFramework);

                Assert.Equal("DarkGray", directedGraph.Links[0].Stroke);
            }
Пример #5
0
            public async Task MinVersionUpgradeActionIsForestGreenLink()
            {
                var package     = StubPackageFactory.CreatePackage("Package", "1.0.0", StubPackageDependencyFactory.Create("Dependency", "1.0.0"));
                var dependency1 = StubPackageFactory.CreatePackage("Dependency", "1.0.0");
                var dependency2 = StubPackageFactory.CreatePackage("Dependency", "2.0.0");
                var repository  = StubSourceRepositoryFactory.Create(new[] { package, dependency1, dependency2, });

                var directedGraph = await new[] { package, }.VisualizeUpgradeableDependenciesAsync(repository, _targetFramework);

                Assert.Equal("ForestGreen", directedGraph.Links[0].Stroke);
            }
Пример #6
0
            public async Task ReleaseToPrereleaseUpgradeActionIsFirebrickLink()
            {
                var package              = StubPackageFactory.CreatePackage("Exact", "1.0.0", StubPackageDependencyFactory.CreateExact("Dependency", "1.0.0"));
                var dependencyRelease    = StubPackageFactory.CreatePackage("Dependency", "1.0.0");
                var dependencyPrerelease = StubPackageFactory.CreatePackage("Dependency", "1.1.0-pre");
                var repository           = StubSourceRepositoryFactory.Create(new[] { package, dependencyRelease, dependencyPrerelease, });

                var directedGraph = await new[] { package, }.VisualizeUpgradeableDependenciesAsync(repository, _targetFramework);

                Assert.Equal("Firebrick", directedGraph.Links[0].Stroke);
            }
Пример #7
0
            public async Task PrereleaseToPrereleaseUpgradeActionIsOrangeRedLink()
            {
                var package         = StubPackageFactory.CreatePackage("Package", "1.0.0", StubPackageDependencyFactory.CreateExact("Dependency", "1.0.0-alpha"));
                var dependencyAlpha = StubPackageFactory.CreatePackage("Dependency", "1.0.0-alpha");
                var dependencyBeta  = StubPackageFactory.CreatePackage("Dependency", "1.0.0-beta");
                var repository      = StubSourceRepositoryFactory.Create(new[] { package, dependencyAlpha, dependencyBeta, });

                var directedGraph = await new[] { package, }.VisualizeUpgradeableDependenciesAsync(repository, _targetFramework);

                Assert.Equal("OrangeRed", directedGraph.Links[0].Stroke);
            }
Пример #8
0
            public async Task PackageIsNodeWithVersion()
            {
                var package    = StubPackageFactory.CreatePackage("A", "1.0.0");
                var repository = StubSourceRepositoryFactory.Create(new[] { package, });

                var directedGraph = await package.VisualizeUpgradeableDependenciesAsync(repository, _targetFramework);

                Assert.Single(directedGraph.Nodes);
                Assert.Equal("A 1.0.0", directedGraph.Nodes[0].Label);
                Assert.Null(directedGraph.Links);
            }
            public void UsesPrereleaseColorOfPaletteAsBackgroundForNodeOfPrereleasePackage()
            {
                var          packageUpgradePalette = new PackageUpgradePalette();
                const string expected = "myColor";

                packageUpgradePalette.PrereleaseColor = expected;
                var visualizer = new PackageUpgradeVisualizer(_directedGraph, packageUpgradePalette);
                var package    = StubPackageFactory.CreatePackage("A", "1.0.0-a");

                visualizer.Visualize(package, Enumerable.Empty <PackageUpgrade>());

                Assert.Equal(expected, _directedGraph.Nodes[0].Background);
            }
            public void UsesUpgradeActionPaletteAsStrokeForLink()
            {
                var          packageUpgradeActionPalette = new PackageUpgradeActionPalette();
                const string expected = "myColor";

                packageUpgradeActionPalette[PackageUpgradeAction.PrereleaseToRelease] = expected;
                var packageUpgradePalette = new PackageUpgradePalette(packageUpgradeActionPalette);
                var visualizer            = new PackageUpgradeVisualizer(_directedGraph, packageUpgradePalette);
                var package        = StubPackageFactory.CreatePackage("A", "1.0.0");
                var packageUpgrade = new PackageUpgrade(
                    StubPackageDependencyFactory.CreateExact("B", "1.0.0"),
                    PackageUpgradeAction.PrereleaseToRelease,
                    null);

                visualizer.Visualize(package, new[] { packageUpgrade, });

                Assert.Equal(expected, _directedGraph.Links[0].Stroke);
            }
 private static PackageUpgrade CreatePackageUpgradeWithPackage()
 => new PackageUpgrade(
     StubPackageDependencyFactory.CreateExact("B", "1.0.0"),
     PackageUpgradeAction.None,
     StubPackageFactory.CreatePackage("B", "1.1.0"));
 private static PackageIdentity CreatePackage() => StubPackageFactory.CreatePackage("A", "1.2.4");