コード例 #1
0
        public void ShouldReturnStringContainingVersionSpec()
        {
            Dependency dependency = new Dependency {VersionSpec = "(1.0,4.5]"};

            string dependencyString = _dependencyStringFactory.CreateDependencyString(dependency);

            StringAssert.Contains(dependency.VersionSpec, dependencyString, "VersionSpec should have been included in the dependency string.");
        }
コード例 #2
0
        public void ShouldReturnStringContainingNameOfDependency()
        {
            Dependency dependency = new Dependency {Name = "MyDependency"};

            string dependencyString = _dependencyStringFactory.CreateDependencyString(dependency);

            StringAssert.Contains(dependency.Name, dependencyString, "Name should have been included in the dependency string.");
        }
コード例 #3
0
 public string CreateDependencyString(Dependency dependency)
 {
     if (dependency == null)
     {
         throw new ArgumentNullException("dependency");
     }
     return string.Format("{0}:{1}", dependency.Name, dependency.VersionSpec);
 }
コード例 #4
0
        public void ShouldReturnNameFollowedByVersionSpecSeparatedByColon()
        {
            Dependency dependency = new Dependency {Name = "PackageId", VersionSpec = "1.0"};
            string expectedDependencyString = string.Format("{0}:{1}", dependency.Name, dependency.VersionSpec);

            string dependencyString = _dependencyStringFactory.CreateDependencyString(dependency);

            StringAssert.AreEqualIgnoringCase(expectedDependencyString, dependencyString, "Dependency string was formatted incorrectly.");
        }