Inheritance: PackageSourceCommand
        public void WhenNameSpecified_FiltersListByWildcard()
        {
            // Arrange
            GetPackageSourceCommand cmd = new GetPackageSourceCommand().AutoConfigure();
            var mockService = new Mock<PackageSourceService>() { CallBase = true };
            cmd.SourceService = mockService.Object;
            cmd.Name = "*ar";

            PackageSource[] expected = new[] {
                new PackageSource("http://foo.bar", "Foo"),
                new PackageSource("http://bar.baz", "Bar"),
                new PackageSource("http://baz.boz", "Qar")
            };
            mockService.Setup(s => s.AllSources).Returns(expected);

            // Act
            PackageSource[] actual = cmd.Execute().ObjectStream.Cast<PackageSource>().ToArray();

            // Assert
            Assert.Equal(expected.Skip(1).ToArray(), actual);
        }
        public void WhenNoParametersSpecified_WritesMergedSourcesList()
        {
            // Arrange
            GetPackageSourceCommand cmd = new GetPackageSourceCommand().AutoConfigure();
            var mockService = new Mock<PackageSourceService>() { CallBase = true };
            cmd.SourceService = mockService.Object;

            PackageSource[] expected = new[] {
                new PackageSource("http://foo.bar", "Foo"),
                new PackageSource("http://bar.baz", "Bar"),
                new PackageSource("http://baz.boz", "Baz")
            };

            mockService.Setup(s => s.AllSources).Returns(expected);

            // Act
            PackageSource[] actual = cmd.Execute().ObjectStream.Cast<PackageSource>().ToArray();

            // Assert
            Assert.Equal(expected, actual);
        }
        public void WhenScopeParameterSpecified_WritesSourceList(PackageSourceScope scope, Expression<Func<PackageSourceService, IPackageSourceStore>> storeSelector)
        {
            // Arrange
            GetPackageSourceCommand cmd = new GetPackageSourceCommand().AutoConfigure();
            var mockService = new Mock<PackageSourceService>() { CallBase = true };
            cmd.SourceService = mockService.Object;
            cmd.Scope = scope;

            PackageSource[] expected = new[] {
                new PackageSource("http://foo.bar", "Foo"),
                new PackageSource("http://bar.baz", "Bar"),
                new PackageSource("http://baz.boz", "Baz")
            };
            mockService.Setup(storeSelector).Returns(new InMemorySourceStore(expected));

            // Act
            PackageSource[] actual = cmd.Execute().ObjectStream.Cast<PackageSource>().ToArray();

            // Assert
            Assert.Equal(expected, actual);
        }