public void FromProjectOverrideVersionNoSymbols() { var name = Assembly.GetExecutingAssembly().GetName().Name; var input = Path.Combine(SolutionDir, name, name + ".csproj"); var outputDirectory = PrepareOutputDirectory(); var version = String.Format( "{0}.{1}.{2}-test", mRandom.Next(1024), mRandom.Next(1024), mRandom.Next(1024)); var task = new CreateNuGetPackage { BuildEngine = BuildEngine, SolutionDir = SolutionDir, ProjectDir = ProjectDir, InputFile = input, Verbosity = "detailed", BasePath = BasePath, OutputDirectory = outputDirectory, Version = version, Symbols = false, ExtraArguments = "-Prop Configuration=" + Configuration }; VerifyOutput(task, false, version); }
public virtual ITaskItem CreatePackageHelper() { var name = Assembly.GetExecutingAssembly().GetName().Name; var input = Path.Combine(SolutionDir, name, name + ".csproj"); var outputDirectory = PrepareOutputDirectory(); var version = String.Format( "{0}.{1}.{2}-test", mRandom.Next(1024), mRandom.Next(1024), mRandom.Next(1024)); var task = new CreateNuGetPackage { BuildEngine = BuildEngine, SolutionDir = SolutionDir, InputFile = input, Verbosity = "quiet", BasePath = BasePath, OutputDirectory = outputDirectory, Version = version, ExtraArguments = "-Prop Configuration=" + Configuration }; var package = VerifyOutput(task, false, version); return package; }
public void FromProjectNoSymbols() { var name = Assembly.GetExecutingAssembly().GetName().Name; var input = Path.Combine(SolutionDir, name, name + ".csproj"); var outputDirectory = PrepareOutputDirectory(); var task = new CreateNuGetPackage { BuildEngine = BuildEngine, SolutionDir = SolutionDir, ProjectDir = ProjectDir, InputFile = input, Verbosity = "detailed", BasePath = BasePath, OutputDirectory = outputDirectory, Symbols = false, ExtraArguments = "-Prop Configuration=" + Configuration }; VerifyOutput(task, false); }
public virtual ITaskItem VerifyOutput(CreateNuGetPackage task, bool symbols, string expectedVersion = ExpectedVersion) { var success = task.Execute(); Assert.IsTrue(success, "Checking task return value"); Assert.AreEqual(0, task.ExitCode, "Checking task ErrorCode"); var package = symbols ? task.PackageSymbols : task.PackageOutput; Assert.IsNotNull(package); Assert.IsNotNull(task.FilesWritten); var isWritten = task.FilesWritten.Any(_ => _.ItemSpec == package.ItemSpec); Assert.IsTrue(isWritten, "Checking if package exists in FileWritten array"); var packagePath = VerifyPackageOutput(package); if (!String.IsNullOrEmpty(expectedVersion)) VerifyPackageVersion(packagePath, expectedVersion); return package; }
public void FromNuSpecMissing() { var name = Assembly.GetExecutingAssembly().GetName().Name; var input = Path.Combine(SolutionDir, name, name + ".cant-find-me.nuspec"); var outputDirectory = PrepareOutputDirectory(); var task = new CreateNuGetPackage { BuildEngine = BuildEngine, SolutionDir = SolutionDir, ProjectDir = ProjectDir, InputFile = input, Verbosity = "detailed", BasePath = BasePath, OutputDirectory = outputDirectory, ExtraArguments = "-Prop Configuration=" + Configuration }; var success = task.Execute(); Assert.IsFalse(success, "Checking task return value"); Assert.AreNotEqual(0, task.ExitCode, "Checking task ErrorCode"); Assert.IsNull(task.PackageOutput, "Checking if PackageOutput is null"); Assert.IsNull(task.PackageSymbols, "Checking if PackageSymbols is null"); }