当前位置: 首页>>代码示例>>C#>>正文


C# Dependency.RemovePossibleVersion方法代码示例

本文整理汇总了C#中Dependency.RemovePossibleVersion方法的典型用法代码示例。如果您正苦于以下问题:C# Dependency.RemovePossibleVersion方法的具体用法?C# Dependency.RemovePossibleVersion怎么用?C# Dependency.RemovePossibleVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dependency的用法示例。


在下文中一共展示了Dependency.RemovePossibleVersion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestPossibleVersions

        public void TestPossibleVersions()
        {
            Dependency dep = new Dependency("test", "artifact1", "2.0");

            // adding multiple versions to a concrete version results in only that one.
           dep.AddVersion("0.1");

            Assert.False(dep.HasPossibleVersions);

            dep.AddVersion("1.0");
            dep.AddVersion("2.0.0");
            dep.AddVersion("3.0");

            Assert.True(dep.HasPossibleVersions);

            Assert.True(dep.BestVersion == "2.0.0");

            dep.RemovePossibleVersion(dep.BestVersion);

            Assert.False(dep.HasPossibleVersions);

            dep = new Dependency("test", "artifact1", "2.0+");

            // check plus
            dep.AddVersion("1.0");
            dep.AddVersion("2.0.0");
            dep.AddVersion("2.0.1");
            dep.AddVersion("2.1");
            dep.AddVersion("3.0");

            Assert.True(dep.HasPossibleVersions);
            Assert.True(dep.BestVersion == "2.1");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.True(dep.BestVersion == "2.0.1");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.True(dep.BestVersion == "2.0.0");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.IsNullOrEmpty(dep.BestVersion);
            Assert.False(dep.HasPossibleVersions);

            dep = new Dependency("test", "artifact1", "2.0+");

            // check plus
            dep.AddVersion("3.0");
            dep.AddVersion("2.2.0");
            dep.AddVersion("2.0.1");
            dep.AddVersion("2.1");
            dep.AddVersion("1.0");

            Assert.True(dep.HasPossibleVersions);
            Assert.True(dep.BestVersion == "2.2.0");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.True(dep.BestVersion == "2.1");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.True(dep.BestVersion == "2.0.1");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.IsNullOrEmpty(dep.BestVersion);
            Assert.False(dep.HasPossibleVersions);
        }
开发者ID:googlesamples,项目名称:unity-jar-resolver,代码行数:59,代码来源:DependencyTests.cs

示例2: TestRefineVersionRange

        public void TestRefineVersionRange()
        {
            Dependency dep = new Dependency("test", "artifact1", "2.0+");

            dep.AddVersion("3.0");
            dep.AddVersion("2.2.0");
            dep.AddVersion("2.0.1");
            dep.AddVersion("2.1");
            dep.AddVersion("1.0");

            // refinement with the same object should have no effect.
            Assert.True(dep.RefineVersionRange(dep));
            Assert.True(dep.HasPossibleVersions);
            Assert.True(dep.BestVersion == "2.2.0");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.True(dep.BestVersion == "2.1");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.True(dep.BestVersion == "2.0.1");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.IsNullOrEmpty(dep.BestVersion);
            Assert.False(dep.HasPossibleVersions);

            // refinement with a concrete version not compatible should fail.
            dep = new Dependency("test", "artifact1", "2.0+");
           
            dep.AddVersion("3.0");
            dep.AddVersion("2.2.0");
            dep.AddVersion("2.0.1");
            dep.AddVersion("2.1");
            dep.AddVersion("1.0");

            Dependency dep1 = new Dependency("test", "artifact1", "3.0");

            Assert.False(dep.RefineVersionRange(dep1));
            Assert.False(dep.HasPossibleVersions);

            // concrete included
            dep = new Dependency("test", "artifact1", "2.0+");

            dep.AddVersion("3.0");
            dep.AddVersion("2.2.0");
            dep.AddVersion("2.0.1");
            dep.AddVersion("2.1");
            dep.AddVersion("1.0");

            Dependency dep2 = new Dependency("test", "artifact1", "2.1.0");

            Assert.True(dep.RefineVersionRange(dep2));
            Assert.True(dep.BestVersion == "2.1");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.False(dep.HasPossibleVersions);

            // check overlapping ranges
            dep = new Dependency("test", "artifact1", "2.0+");

            dep.AddVersion("3.0");
            dep.AddVersion("2.2.0");
            dep.AddVersion("2.0.1");
            dep.AddVersion("2.1");
            dep.AddVersion("1.0");

            Dependency dep1plus = new Dependency("test", "artifact1", "2.1+");

            Assert.True(dep.RefineVersionRange(dep1plus));
            Assert.True(dep.BestVersion == "2.2.0");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.True(dep.BestVersion == "2.1");
            dep.RemovePossibleVersion(dep.BestVersion);
            Assert.False(dep.HasPossibleVersions);
        }
开发者ID:googlesamples,项目名称:unity-jar-resolver,代码行数:70,代码来源:DependencyTests.cs

示例3: FindCandidate

        /// <summary>
        /// Finds an acceptable candidate for the given dependency.
        /// </summary>
        /// <returns>The dependency modified so BestVersion returns the best version.</returns>
        /// <param name="repoPath">The path to the artifact repository.</param>
        /// <param name="dep">The dependency to find a specific version for.</param>
        internal Dependency FindCandidate(string repoPath, Dependency dep)
        {
            string basePath = Path.Combine(dep.Group, dep.Artifact);
            basePath = basePath.Replace(".", Path.DirectorySeparatorChar.ToString());

            string metadataFile = Path.Combine(Path.Combine(repoPath, basePath), "maven-metadata.xml");
            if (File.Exists(metadataFile))
            {
                ProcessMetadata(dep, metadataFile);
                dep.RepoPath = repoPath;
            }
            else
            {
                return null;
            }

            while (dep.HasPossibleVersions)
            {

                // TODO(wilkinsonclay): get the packaging from the pom.
                // Check for the actual file existing, otherwise skip this version.
                foreach (string ext in Packaging)
                {
                    string basename = dep.Artifact + "-" + dep.BestVersion + ext;
                    string fname = Path.Combine(dep.BestVersionPath, basename);

                    if (File.Exists(fname))
                    {
                        return dep;
                    }
                }

                Log(dep.Key + " version " + dep.BestVersion + " not available, ignoring.",
                    verbose: true);
                dep.RemovePossibleVersion(dep.BestVersion);
            }

            return null;
        }
开发者ID:googlesamples,项目名称:unity-jar-resolver,代码行数:45,代码来源:PlayServicesSupport.cs


注:本文中的Dependency.RemovePossibleVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。