Beispiel #1
0
        public void Implicit()
        {
            var properties = ImmutableStringDictionary <string> .EmptyOrdinal.Add("myProp", "myVal");

            var model = new PackageDependencyModel(
                originalItemSpec: "myOriginalItemSpec",
                version: "",
                isResolved: true,
                isImplicit: true,
                properties: properties,
                isVisible: true);

            Assert.Equal(PackageRuleHandler.ProviderTypeString, model.ProviderType);
            Assert.Equal("myOriginalItemSpec", model.OriginalItemSpec);
            Assert.Equal("myOriginalItemSpec", model.Id);
            Assert.Equal("myOriginalItemSpec", model.Caption);
            Assert.Equal(ResolvedPackageReference.SchemaName, model.SchemaName);
            Assert.Equal(PackageReference.PrimaryDataSourceItemType, model.SchemaItemType);
            Assert.True(model.Visible);
            Assert.True(model.Resolved);
            Assert.True(model.Implicit);
            Assert.Equal(properties, model.Properties);
            Assert.Equal(KnownMonikers.NuGetNoColorPrivate, model.Icon);
            Assert.Equal(KnownMonikers.NuGetNoColorPrivate, model.ExpandedIcon);
            Assert.Equal(KnownMonikers.NuGetNoColorWarning, model.UnresolvedIcon);
            Assert.Equal(KnownMonikers.NuGetNoColorWarning, model.UnresolvedExpandedIcon);
            Assert.Equal(
                DependencyTreeFlags.PackageDependency +
                DependencyTreeFlags.SupportsFolderBrowse +
                DependencyTreeFlags.ResolvedDependencyFlags +
                ProjectTreeFlags.Create("$ID:myOriginalItemSpec") -
                DependencyTreeFlags.SupportsRemove,
                model.Flags);
        }
        public void Unresolved()
        {
            var properties = ImmutableStringDictionary <string> .EmptyOrdinal.Add("myProp", "myVal");

            var model = new PackageDependencyModel(
                originalItemSpec: "myOriginalItemSpec",
                version: "myVersion",
                isResolved: false,
                isImplicit: false,
                properties: properties,
                isVisible: true);

            Assert.Equal(PackageRuleHandler.ProviderTypeString, model.ProviderType);
            Assert.Equal("myOriginalItemSpec", model.OriginalItemSpec);
            Assert.Equal("myOriginalItemSpec", model.Id);
            Assert.Equal("myOriginalItemSpec (myVersion)", model.Caption);
            Assert.Equal(PackageReference.SchemaName, model.SchemaName);
            Assert.Equal(PackageReference.PrimaryDataSourceItemType, model.SchemaItemType);
            Assert.True(model.Visible);
            Assert.False(model.Resolved);
            Assert.False(model.Implicit);
            Assert.Equal(properties, model.Properties);
            Assert.Equal(ManagedImageMonikers.NuGetGrey, model.Icon);
            Assert.Equal(ManagedImageMonikers.NuGetGrey, model.ExpandedIcon);
            Assert.Equal(ManagedImageMonikers.NuGetGreyWarning, model.UnresolvedIcon);
            Assert.Equal(ManagedImageMonikers.NuGetGreyWarning, model.UnresolvedExpandedIcon);
            Assert.Equal(
                DependencyTreeFlags.PackageDependency +
                DependencyTreeFlags.UnresolvedDependencyFlags +
                ProjectTreeFlags.Create("$ID:myOriginalItemSpec"),
                model.Flags);
        }