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"); }