public void IsDependencyValidForGraphTest(LibraryDependencyReferenceType referenceType, bool versionCentrallyManaged)
        {
            var centralPackageName    = "D";
            var context               = new TestRemoteWalkContext();
            var centralPackageVersion = new CentralPackageVersion(centralPackageName, VersionRange.Parse("2.0.0"));
            var centralPackageVersionDependecy_VersionCentrallyManaged = new LibraryDependency()
            {
                LibraryRange            = new LibraryRange(centralPackageVersion.Name, centralPackageVersion.VersionRange, LibraryDependencyTarget.Package),
                VersionCentrallyManaged = versionCentrallyManaged,
                ReferenceType           = referenceType,
            };
            var walker = new RemoteDependencyWalker(context);

            // Act
            var expectedResult = walker.IsDependencyValidForGraph(centralPackageVersionDependecy_VersionCentrallyManaged);

            // Assert
            if (referenceType != LibraryDependencyReferenceType.None)
            {
                Assert.True(expectedResult);
            }
            else
            {
                Assert.False(expectedResult);
            }
        }
Пример #2
0
 public LibraryDependency(
     LibraryRange libraryRange,
     LibraryDependencyType type,
     LibraryIncludeFlags includeType,
     LibraryIncludeFlags suppressParent,
     IList <NuGetLogCode> noWarn,
     bool autoReferenced,
     bool generatePathProperty,
     bool versionCentrallyManaged,
     LibraryDependencyReferenceType libraryDependencyReferenceType)
     : this(libraryRange, type, includeType, suppressParent, noWarn, autoReferenced, generatePathProperty, versionCentrallyManaged, libraryDependencyReferenceType, aliases : null)
 {
 }
Пример #3
0
 internal LibraryDependency(
     LibraryRange libraryRange,
     LibraryIncludeFlags includeType,
     LibraryIncludeFlags suppressParent,
     IList <NuGetLogCode> noWarn,
     bool autoReferenced,
     bool generatePathProperty,
     bool versionCentrallyManaged,
     LibraryDependencyReferenceType libraryDependencyReferenceType,
     string aliases)
 {
     LibraryRange            = libraryRange;
     IncludeType             = includeType;
     SuppressParent          = suppressParent;
     NoWarn                  = noWarn;
     AutoReferenced          = autoReferenced;
     GeneratePathProperty    = generatePathProperty;
     VersionCentrallyManaged = versionCentrallyManaged;
     ReferenceType           = libraryDependencyReferenceType;
     Aliases                 = aliases;
 }
Пример #4
0
            public TestPackage DependsOn(string id, string version, LibraryDependencyTarget target = LibraryDependencyTarget.All, bool versionCentrallyManaged = false, LibraryDependencyReferenceType libraryDependencyReferenceType = LibraryDependencyReferenceType.Direct)
            {
                _dependencies.Add(new LibraryDependency
                {
                    LibraryRange = new LibraryRange
                    {
                        Name           = id,
                        VersionRange   = VersionRange.Parse(version),
                        TypeConstraint = target
                    },
                    VersionCentrallyManaged = versionCentrallyManaged,
                    ReferenceType           = libraryDependencyReferenceType,
                });

                return(this);
            }