public void WillAppendTheApiPathToTheApiUri() { var cmdlet = new TestableGetRemotePackageIdCommand(); cmdlet.GetResults().Cast<string>(); Assert.Equal("/api/v2/package-ids", cmdlet.ActualApiEndpointUri.PathAndQuery); }
public void WillAppendTheApiPathToTheApiUri() { var cmdlet = new TestableGetRemotePackageIdCommand(); cmdlet.GetResults().Cast <string>(); Assert.Equal("/api/v2/package-ids", cmdlet.ActualApiEndpointUri.PathAndQuery); }
public void WillUseTheActivePackageSourceToBuildTheUriWhenNoSourceParameterIsSpecified() { var cmdlet = new TestableGetRemotePackageIdCommand { StubPackageSource = "http://theActivePackageSourceBaseUri" }; cmdlet.GetResults().Cast <string>(); Assert.Equal("http://theactivepackagesourcebaseuri", cmdlet.ActualApiEndpointUri.GetLeftPart(UriPartial.Authority)); }
public void WillUseTheSourceParameterWhenSpecified() { var cmdlet = new TestableGetRemotePackageIdCommand { Source = "http://theSourceParameterUri" }; cmdlet.GetResults().Cast <string>(); Assert.Equal("http://thesourceparameteruri", cmdlet.ActualApiEndpointUri.GetLeftPart(UriPartial.Authority)); }
public void WillIncludeAPartialIdQueryStringParameterInApiUriWhenFilterParameterIsNotEmpty() { var cmdlet = new TestableGetRemotePackageIdCommand { Filter = "thePartialId" }; cmdlet.GetResults().Cast<string>(); Assert.Contains("partialId=thePartialId", cmdlet.ActualApiEndpointUri.ToString()); }
public void WillUseTheSourceParameterWhenSpecified() { var cmdlet = new TestableGetRemotePackageIdCommand { Source = "http://theSourceParameterUri" }; cmdlet.GetResults().Cast<string>(); Assert.Equal("http://thesourceparameteruri", cmdlet.ActualApiEndpointUri.GetLeftPart(UriPartial.Authority)); }
public void WillUseTheActivePackageSourceToBuildTheUriWhenNoSourceParameterIsSpecified() { var cmdlet = new TestableGetRemotePackageIdCommand { StubPackageSource = "http://theActivePackageSourceBaseUri" }; cmdlet.GetResults().Cast<string>(); Assert.Equal("http://theactivepackagesourcebaseuri", cmdlet.ActualApiEndpointUri.GetLeftPart(UriPartial.Authority)); }
public void WillNotIncludeAPartialIdQueryStringParameterInApiUriWhenFilterParameterIsNotEmpty() { var cmdlet = new TestableGetRemotePackageIdCommand { Filter = null }; cmdlet.GetResults().Cast <string>(); Assert.DoesNotContain("partialId", cmdlet.ActualApiEndpointUri.ToString()); }
public void WillIncludeAPrereleaseQueryStringParameterInApiUriWhenPrereleaseParameterIsTrue() { var cmdlet = new TestableGetRemotePackageIdCommand { IncludePrerelease = true }; cmdlet.GetResults().Cast <string>(); Assert.Contains("includePrerelease=true", cmdlet.ActualApiEndpointUri.ToString()); }
public void WillWriteThePackageIdsReturnedFromTheApiCall() { var cmdlet = new TestableGetRemotePackageIdCommand { StubResults = new string[] { "theFirstPackageId", "theSecondPackageId" } }; var result = cmdlet.GetResults().Cast<string>(); Assert.Equal("theFirstPackageId", result.First()); Assert.Equal("theSecondPackageId", result.ElementAt(1)); }
public void WillWriteThePackageIdsReturnedFromTheApiCall() { var cmdlet = new TestableGetRemotePackageIdCommand { StubResults = new string[] { "theFirstPackageId", "theSecondPackageId" } }; var result = cmdlet.GetResults().Cast <string>(); Assert.Equal("theFirstPackageId", result.First()); Assert.Equal("theSecondPackageId", result.ElementAt(1)); }
public void WillUseTheRepositoryPackagesWhenTheRepositoryIsNotHttpBased() { var cmdlet = new TestableGetRemotePackageIdCommand { StubPackageSource = "c:\\aPackageDir", StubRepositoryPackages = new IPackage[] { CreateStubPackage("theFirstPackageId"), CreateStubPackage("theSecondPackageId"), } }; var result = cmdlet.GetResults().Cast <string>(); Assert.Equal("theFirstPackageId", result.First()); Assert.Equal("theSecondPackageId", result.ElementAt(1)); }
public void WillNotIncludeRepositoryPackagesWithPrereleaseVersionsWhenNotFlagged() { var cmdlet = new TestableGetRemotePackageIdCommand { IncludePrerelease = false, StubPackageSource = "c:\\aPackageDir", StubRepositoryPackages = new IPackage[] { CreateStubPackage("theFirstPackageId"), CreateStubPackage("theSecondPackageId", "0.1-pre"), } }; var result = cmdlet.GetResults().Cast <string>(); Assert.Equal("theFirstPackageId", result.First()); Assert.Equal(1, result.Count()); }
public void WillFilterRepositoryPackages() { var cmdlet = new TestableGetRemotePackageIdCommand { Filter = "theFirst", StubPackageSource = "c:\\aPackageDir", StubRepositoryPackages = new IPackage[] { CreateStubPackage("theFirstPackageId"), CreateStubPackage("theSecondPackageId"), } }; var result = cmdlet.GetResults().Cast <string>(); Assert.Equal("theFirstPackageId", result.First()); Assert.Equal(1, result.Count()); }
public void WillAggregateResultsWhenThePackageRepositoryIsAnAggregateRepository() { var cmdlet = new TestableGetRemotePackageIdCommand { StubResults = new [] { "theFirstPackageId", "theSecondPackageId" }, StubPackageRepository = new AggregateRepository( new [] { CreateStubPackageRepository( new [] { CreateStubPackage("theFirstPackageId"), CreateStubPackage("theSecondPackageId"), }, "http://theuri"), CreateStubPackageRepository( new [] { CreateStubPackage("theThirdPackageId"), CreateStubPackage("theFourthPackageId"), }, "c:\\packages"), }), }; var result = cmdlet.GetResults().Cast <string>(); Assert.Contains("theFirstPackageId", result); Assert.Contains("theSecondPackageId", result); Assert.Contains("theThirdPackageId", result); Assert.Contains("theFourthPackageId", result); }
public void WillUseTheRepositoryPackagesWhenTheRepositoryIsNotHttpBased() { var cmdlet = new TestableGetRemotePackageIdCommand { StubPackageSource = "c:\\aPackageDir", StubRepositoryPackages = new IPackage[] { CreateStubPackage("theFirstPackageId"), CreateStubPackage("theSecondPackageId"), } }; var result = cmdlet.GetResults().Cast<string>(); Assert.Equal("theFirstPackageId", result.First()); Assert.Equal("theSecondPackageId", result.ElementAt(1)); }
public void WillNotIncludeRepositoryPackagesWithPrereleaseVersionsWhenNotFlagged() { var cmdlet = new TestableGetRemotePackageIdCommand { IncludePrerelease = false, StubPackageSource = "c:\\aPackageDir", StubRepositoryPackages = new IPackage[] { CreateStubPackage("theFirstPackageId"), CreateStubPackage("theSecondPackageId", "0.1-pre"), } }; var result = cmdlet.GetResults().Cast<string>(); Assert.Equal("theFirstPackageId", result.First()); Assert.Equal(1, result.Count()); }
public void WillAggregateResultsWhenThePackageRepositoryIsAnAggregateRepository() { var cmdlet = new TestableGetRemotePackageIdCommand { StubResults = new [] { "theFirstPackageId", "theSecondPackageId" }, StubPackageRepository = new AggregateRepository( new [] { CreateStubPackageRepository( new [] { CreateStubPackage("theFirstPackageId"), CreateStubPackage("theSecondPackageId"), }, "http://theuri"), CreateStubPackageRepository( new [] { CreateStubPackage("theThirdPackageId"), CreateStubPackage("theFourthPackageId"), }, "c:\\packages"), }), }; var result = cmdlet.GetResults().Cast<string>(); Assert.Contains("theFirstPackageId", result); Assert.Contains("theSecondPackageId", result); Assert.Contains("theThirdPackageId", result); Assert.Contains("theFourthPackageId", result); }
public void WillIncludeAPrereleaseQueryStringParameterInApiUriWhenPrereleaseParameterIsTrue() { var cmdlet = new TestableGetRemotePackageIdCommand { IncludePrerelease = true }; cmdlet.GetResults().Cast<string>(); Assert.Contains("includePrerelease=true", cmdlet.ActualApiEndpointUri.ToString()); }
public void WillFilterRepositoryPackages() { var cmdlet = new TestableGetRemotePackageIdCommand { Filter = "theFirst", StubPackageSource = "c:\\aPackageDir", StubRepositoryPackages = new IPackage[] { CreateStubPackage("theFirstPackageId"), CreateStubPackage("theSecondPackageId"), } }; var result = cmdlet.GetResults().Cast<string>(); Assert.Equal("theFirstPackageId", result.First()); Assert.Equal(1, result.Count()); }