public void PublishAllNugetUnderScope() { PublishSDKNuget pubNug = new PublishSDKNuget(); pubNug.publishAllNugetsUnderScope = true; Assert.Throws <NotSupportedException>(() => pubNug.Execute()); }
public void MissingNugetPackageName() { PublishSDKNuget pubNug = new PublishSDKNuget(); pubNug.PackageOutputPath = NugetPkgBuiltDir; pubNug.PublishNugetToPath = PublishToDir; pubNug.SkipSymbolPublishing = true; Assert.ThrowsAny <NullReferenceException>(() => pubNug.Execute()); }
public void SkipPublishingCompletely() { PublishSDKNuget pubNug = new PublishSDKNuget(); pubNug.PackageOutputPath = NugetPkgBuiltDir; pubNug.NugetPackageName = NUGET_PKG_NAME; pubNug.PublishNugetToPath = PublishToDir; pubNug.SkipSymbolPublishing = true; pubNug.SkipNugetPublishing = true; Assert.Throws <ApplicationException>(() => pubNug.Execute()); }
public void IncorrectNugetExePath() { PublishSDKNuget pubNug = new PublishSDKNuget(); pubNug.PackageOutputPath = NugetPkgBuiltDir; pubNug.NugetPackageName = NUGET_PKG_NAME; pubNug.PublishNugetToPath = PublishToDir; pubNug.SkipSymbolPublishing = true; pubNug.NugetExePath = @"C:\Foo\NoExistantPath\nuget.exe"; Assert.ThrowsAny <Exception>(() => pubNug.Execute()); }
public void PublishOnlySymbol() { PublishSDKNuget pubNug = new PublishSDKNuget(); pubNug.PackageOutputPath = NugetPkgBuiltDir; pubNug.NugetPackageName = NUGET_PKG_NAME; pubNug.PublishNugetToPath = "https://www.nuget.org/api/v2/package/"; pubNug.SkipNugetPublishing = true; pubNug.ApiKey = "1234"; Assert.ThrowsAny <ApplicationException>(() => pubNug.Execute()); }
public void NonExistentPublishLocation() { PublishSDKNuget pubNug = new PublishSDKNuget(); pubNug.PackageOutputPath = NugetPkgBuiltDir; pubNug.NugetPackageName = NUGET_PKG_NAME; pubNug.PublishNugetToPath = "http://somelocation"; pubNug.SkipSymbolPublishing = true; pubNug.ApiKey = "1234"; Assert.ThrowsAny <Exception>(() => pubNug.Execute()); }
public void PublishSingleNuget() { PublishSDKNuget pubNug = new PublishSDKNuget(); pubNug.PackageOutputPath = NugetPkgBuiltDir; pubNug.NugetPackageName = NUGET_PKG_NAME; pubNug.PublishNugetToPath = PublishToDir; pubNug.Execute(); List <NugetPublishStatus> statusList = pubNug.NugetPublishStatus; foreach (NugetPublishStatus status in statusList) { Assert.Equal(0, status.NugetPublishExitCode); } }
public void SkipPublishingSymbols() { PublishSDKNuget pubNug = new PublishSDKNuget(); pubNug.PackageOutputPath = NugetPkgBuiltDir; pubNug.NugetPackageName = NUGET_PKG_NAME; pubNug.PublishNugetToPath = PublishToDir; pubNug.SkipSymbolPublishing = true; pubNug.Execute(); List <NugetPublishStatus> statusList = pubNug.NugetPublishStatus; Assert.Equal(1, statusList?.Count); foreach (NugetPublishStatus status in statusList) { Assert.Equal(0, status.NugetPublishExitCode); } }
public void PublishWithUnAuthenticatedKey() { PublishSDKNuget pubNug = new PublishSDKNuget(); pubNug.PackageOutputPath = NugetPkgBuiltDir; pubNug.NugetPackageName = NUGET_PKG_NAME; pubNug.PublishNugetToPath = "https://www.nuget.org/api/v2/package/"; pubNug.SkipSymbolPublishing = false; pubNug.ApiKey = "1234"; try { pubNug.Execute(); } catch (Exception ex) { if (!ex.Message.Contains("The specified API key is invalid")) { Assert.Equal("The specified API key is invalid", ex.Message); } } }
public void MissingRequiredProperties() { PublishSDKNuget pubNug = new PublishSDKNuget(); Assert.ThrowsAny <NullReferenceException>(() => pubNug.Execute()); }