Пример #1
0
        public void WhenAllVersionsSpecified_WritesAllVersionsOfAllPackagesFromSource()
        {
            // Assert
            GetPackageCommand cmd = new GetPackageCommand().AutoConfigure();
            cmd.RepositoryFactory = TestRepository.CreateFactory();
            cmd.AllVersions = SwitchParameter.Present;
            cmd.Source = "http://foo.bar";

            // Act
            CommandOutput output = cmd.Execute();

            // Assert
            Assert.Equal(TestRepository.DefaultPackages, output.ObjectStream.Cast<IPackage>().ToArray());
        }
Пример #2
0
        public void WhenNoArguments_WritesLatestVersionsOfAllPackagesFromSource()
        {
            // Assert
            GetPackageCommand cmd = new GetPackageCommand().AutoConfigure();
            cmd.RepositoryFactory = TestRepository.CreateFactory();
            cmd.Source = "http://foo.bar";

            // Act
            CommandOutput output = cmd.Execute();

            // Assert
            Assert.Equal(TestRepository.DefaultPackages.Latest().ToArray(), output.ObjectStream.Cast<IPackage>().ToArray());
        }
Пример #3
0
        public void WhenIdSpecified_WritesLatestVersionOfSpecifiedPackageFromSource()
        {
            // Assert
            GetPackageCommand cmd = new GetPackageCommand().AutoConfigure();
            cmd.RepositoryFactory = TestRepository.CreateFactory();
            cmd.Id = "Foo";
            cmd.Source = "http://foo.bar";

            // Act
            CommandOutput output = cmd.Execute();

            // Assert
            Assert.Equal(TestRepository.DefaultPackages.Latest().IdIsExactly("Foo").ToArray(),
                         output.ObjectStream.Cast<IPackage>().ToArray());
        }