コード例 #1
0
 public void CanResolveMinimalVersionSpec(string v1, string v2, string expected)
 {
     var t = new PackageReferenceSetResolver();
     var l = new List<PackageReference>();
     l.Add(new PackageReference("test", SemanticVersion.Parse("1.1.1.1"), VersionUtility.ParseVersionSpec(v1), new FrameworkName(".NET Framework, Version=4.0"), false));
     l.Add(new PackageReference("test", SemanticVersion.Parse("1.1.1.1"), VersionUtility.ParseVersionSpec(v2), new FrameworkName(".NET Framework, Version=4.0"), false));
     var resolvedVs = t.ResolveValidVersionSpec(l);
     AssertAreEqual(expected, resolvedVs);
 }
コード例 #2
0
        public void CanResolveMinimalVersion(string v1, string v2, string expected)
        {
            var t = new PackageReferenceSetResolver();
            var l = new List<PackageReference>();
            l.Add(new PackageReference("test", SemanticVersion.Parse(v1), new VersionSpec(), new FrameworkName(".NET Framework, Version=4.0"), false));
            l.Add(new PackageReference("test", SemanticVersion.Parse(v2), new VersionSpec(), new FrameworkName(".NET Framework, Version=4.0"), false));

            if (expected == null)
                Assert.IsNull(t.ResolveValidVersion(l));
            else
                Assert.AreEqual(SemanticVersion.Parse(expected), t.ResolveValidVersion(l).Version);

        }
コード例 #3
0
        public void CanResolveMinimalVersionSpec(string v1, string v2, string expected)
        {
            var t = new PackageReferenceSetResolver();
            var l = new List<PackageReference>();
            l.Add(new PackageReference("test", SemanticVersion.Parse("1.1.1.1"), VersionUtility.ParseVersionSpec(v1), new FrameworkName(".NET Framework, Version=4.0"), false));
            l.Add(new PackageReference("test", SemanticVersion.Parse("1.1.1.1"), VersionUtility.ParseVersionSpec(v2), new FrameworkName(".NET Framework, Version=4.0"), false));
            var resolvedVs = t.ResolveValidVersionSpec(l);
            if (expected == null)
            {
                Assert.IsNull(resolvedVs);
            }
            else
            {
                var expectedVs = VersionUtility.ParseVersionSpec(expected);
                var iSpec = resolvedVs.VersionConstraint as IVersionSpec;

                //TODO Equality comparer, anyone?  This is pretty crappy....
                Assert.AreEqual(expectedVs.IsMaxInclusive, iSpec.IsMaxInclusive);
                Assert.AreEqual(expectedVs.IsMinInclusive, iSpec.IsMinInclusive);
                Assert.AreEqual(expectedVs.MaxVersion, iSpec.MaxVersion);
                Assert.AreEqual(expectedVs.MinVersion, iSpec.MinVersion);
            }
        }
コード例 #4
0
        public void CanResolvePackageList(string testname)
        {
            var testData = GetTestObjectFromDataFile(testname);

            var t = new PackageReferenceSetResolver();
            var r = t.Resolve(testData.Input);

            //Check output
            foreach (var element in testData.Output)
            {
                Assert.IsTrue(r.Item1.Contains(element));
            }

            //Check failures
            foreach (var element in testData.Error)
            {
                Assert.IsTrue(r.Item2.Contains(element));
            }

        }