コード例 #1
0
        public void WillAppendTheApiPathToTheApiUri()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand();

            cmdlet.GetResults().Cast<string>();

            Assert.Equal("/api/v2/package-ids", cmdlet.ActualApiEndpointUri.PathAndQuery);
        }
コード例 #2
0
        public void WillAppendTheApiPathToTheApiUri()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand();

            cmdlet.GetResults().Cast <string>();

            Assert.Equal("/api/v2/package-ids", cmdlet.ActualApiEndpointUri.PathAndQuery);
        }
コード例 #3
0
        public void WillUseTheActivePackageSourceToBuildTheUriWhenNoSourceParameterIsSpecified()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand
            {
                StubPackageSource = "http://theActivePackageSourceBaseUri"
            };

            cmdlet.GetResults().Cast <string>();

            Assert.Equal("http://theactivepackagesourcebaseuri", cmdlet.ActualApiEndpointUri.GetLeftPart(UriPartial.Authority));
        }
コード例 #4
0
        public void WillUseTheSourceParameterWhenSpecified()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand
            {
                Source = "http://theSourceParameterUri"
            };

            cmdlet.GetResults().Cast <string>();

            Assert.Equal("http://thesourceparameteruri", cmdlet.ActualApiEndpointUri.GetLeftPart(UriPartial.Authority));
        }
コード例 #5
0
        public void WillIncludeAPartialIdQueryStringParameterInApiUriWhenFilterParameterIsNotEmpty()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand
            {
                Filter = "thePartialId"
            };

            cmdlet.GetResults().Cast<string>();

            Assert.Contains("partialId=thePartialId", cmdlet.ActualApiEndpointUri.ToString());
        }
コード例 #6
0
        public void WillUseTheSourceParameterWhenSpecified()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand
            {
                Source = "http://theSourceParameterUri"
            };

            cmdlet.GetResults().Cast<string>();

            Assert.Equal("http://thesourceparameteruri", cmdlet.ActualApiEndpointUri.GetLeftPart(UriPartial.Authority));
        }
コード例 #7
0
        public void WillUseTheActivePackageSourceToBuildTheUriWhenNoSourceParameterIsSpecified()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand
            {
                StubPackageSource = "http://theActivePackageSourceBaseUri"
            };

            cmdlet.GetResults().Cast<string>();

            Assert.Equal("http://theactivepackagesourcebaseuri", cmdlet.ActualApiEndpointUri.GetLeftPart(UriPartial.Authority));
        }
コード例 #8
0
        public void WillNotIncludeAPartialIdQueryStringParameterInApiUriWhenFilterParameterIsNotEmpty()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand
            {
                Filter = null
            };

            cmdlet.GetResults().Cast <string>();

            Assert.DoesNotContain("partialId", cmdlet.ActualApiEndpointUri.ToString());
        }
コード例 #9
0
        public void WillIncludeAPrereleaseQueryStringParameterInApiUriWhenPrereleaseParameterIsTrue()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand
            {
                IncludePrerelease = true
            };

            cmdlet.GetResults().Cast <string>();

            Assert.Contains("includePrerelease=true", cmdlet.ActualApiEndpointUri.ToString());
        }
コード例 #10
0
        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));
        }
コード例 #11
0
        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));
        }
コード例 #12
0
        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));
        }
コード例 #13
0
        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());
        }
コード例 #14
0
        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());
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        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));
        }
コード例 #17
0
        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());
        }
コード例 #18
0
        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);
        }
コード例 #19
0
        public void WillIncludeAPrereleaseQueryStringParameterInApiUriWhenPrereleaseParameterIsTrue()
        {
            var cmdlet = new TestableGetRemotePackageIdCommand
            {
                IncludePrerelease = true
            };

            cmdlet.GetResults().Cast<string>();

            Assert.Contains("includePrerelease=true", cmdlet.ActualApiEndpointUri.ToString());
        }
コード例 #20
0
        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());
        }