예제 #1
0
        public void AssemblyNameReplacesNullDescription()
        {
            var          console         = new ConsoleMock();
            const string anyAssemblyName = "any.assembly.name";
            var          nullDataSource  = new Mock <INuspecDataSource>().Object;

            var nuspecBuilder = new NuspecBuilder(anyAssemblyName);

            nuspecBuilder.SetMetadata(nullDataSource, new List <ManifestDependency>());
            nuspecBuilder.Save(console.Object);

            var nuspecContents = File.ReadAllText(nuspecBuilder.FilePath);

            Assert.That(nuspecContents, Contains.Substring("<description>" + anyAssemblyName + "</description>"));
            console.AssertConsoleHasNoErrorsOrWarnings();
        }
예제 #2
0
        private void NugetifyProject(IVsProject projectAdapter, DirectoryInfo solutionRoot, ISharedPackageRepository existingSolutionPackagesRepo)
        {
            var targetFramework = TargetFramework != null?VersionUtility.ParseFrameworkName(TargetFramework) : null;

            var projectNugetifier = CreateProjectNugetifier(projectAdapter);
            var packagesAdded     = projectNugetifier.NugetifyReferences(solutionRoot);

            projectNugetifier.AddNugetReferenceMetadata(existingSolutionPackagesRepo, packagesAdded, targetFramework);
            projectAdapter.Save();

            if (NuSpec)
            {
                var manifestDependencies = projectNugetifier.GetManifestDependencies(packagesAdded);
                var nuspecBuilder        = new NuspecBuilder(projectAdapter.AssemblyName);
                nuspecBuilder.SetMetadata(this, manifestDependencies);
                nuspecBuilder.SetDependencies(manifestDependencies, TargetFramework);
                nuspecBuilder.Save(Console);
            }
        }
예제 #3
0
        public void TargetFrameworkAppearsVerbatimInOutput(string targetFramework)
        {
            var console = new ConsoleMock();

            var nuspecBuilder   = new NuspecBuilder("anyAssemblyName");
            var anyDependencies = new List <ManifestDependency> {
                new ManifestDependency {
                    Id = "anyDependency", Version = "0.0.0.0"
                }
            };

            nuspecBuilder.SetDependencies(anyDependencies, targetFramework);
            nuspecBuilder.Save(console.Object);

            var nuspecContents = File.ReadAllText(nuspecBuilder.FilePath);
            var expectedAssemblyGroupStartTag = string.Format("<group targetFramework=\"{0}\">", targetFramework);

            Assert.That(nuspecContents, Contains.Substring(expectedAssemblyGroupStartTag));
            console.AssertConsoleHasNoErrorsOrWarnings();
        }