Exemple #1
0
        public void GetPackages_ProjectManagerLocalRepositoryHasTwoPackages_ReturnsTwoPackages()
        {
            CreateProject();
            FakePackageRepository repository = fakeProjectManager.FakeLocalRepository;
            FakePackage           packageA   = repository.AddFakePackage("A");
            FakePackage           packageB   = repository.AddFakePackage("B");

            IQueryable <IPackage> actualPackages = project.GetPackages();

            var expectedPackages = new FakePackage[] {
                packageA,
                packageB
            };

            PackageCollectionAssert.AreEqual(expectedPackages, actualPackages);
        }
        public void ProcessRecord_ListAvailablePackagesWhenDefaultPackageSourceHasThreePackages_OutputIsPackagesFromPackageSourceRepository()
        {
            CreateCmdlet();
            FakePackageRepository repository = fakeRegisteredPackageRepositories.FakePackageRepository;

            repository.AddFakePackage("A");
            repository.AddFakePackage("B");
            repository.AddFakePackage("C");

            EnableListAvailableParameter();
            RunCmdlet();

            List <object>      actualPackages   = fakeCommandRuntime.ObjectsPassedToWriteObject;
            List <FakePackage> expectedPackages = repository.FakePackages;

            CollectionAssert.AreEqual(expectedPackages, actualPackages);
        }
        public void ProcessRecord_ListAvailablePackagesWhenDefaultPackageSourceHasTwoPackages_PackagesAreSortedById()
        {
            CreateCmdlet();
            FakePackageRepository repository = fakeRegisteredPackageRepositories.FakePackageRepository;
            FakePackage           packageB   = repository.AddFakePackage("B");
            FakePackage           packageA   = repository.AddFakePackage("A");

            EnableListAvailableParameter();
            RunCmdlet();

            List <object> actualPackages   = fakeCommandRuntime.ObjectsPassedToWriteObject;
            var           expectedPackages = new FakePackage[] {
                packageA,
                packageB
            };

            CollectionAssert.AreEqual(expectedPackages, actualPackages);
        }
        public void ProcessRecord_ListAvailableAndSkipFirstTwoPackages_ReturnsAllPackagesExceptionFirstTwo()
        {
            CreateCmdlet();
            FakePackageRepository repository = fakeRegisteredPackageRepositories.FakePackageRepository;

            repository.AddFakePackage("A");
            repository.AddFakePackage("B");
            FakePackage packageC = repository.AddFakePackage("C");

            EnableListAvailableParameter();
            SetSkipParameter(2);
            RunCmdlet();

            List <object> actualPackages   = fakeCommandRuntime.ObjectsPassedToWriteObject;
            var           expectedPackages = new FakePackage[] {
                packageC
            };

            CollectionAssert.AreEqual(expectedPackages, actualPackages);
        }
        public void ProcessRecord_RecentPackagesRequestedWithFilter_FilteredRecentPackagesReturned()
        {
            CreateCmdlet();

            FakePackageRepository recentPackageRepository = fakeRegisteredPackageRepositories.FakeRecentPackageRepository;

            recentPackageRepository.AddFakePackage("A");
            FakePackage packageB = recentPackageRepository.AddFakePackage("B");

            EnableRecentParameter();
            SetFilterParameter("B");
            RunCmdlet();

            List <object> actualPackages   = fakeCommandRuntime.ObjectsPassedToWriteObject;
            var           expectedPackages = new FakePackage[] {
                packageB
            };

            Assert.AreEqual(expectedPackages, actualPackages);
        }
        public void ProcessRecord_ListAvailablePackagesAndFilterResults_PackagesReturnedMatchFilter()
        {
            CreateCmdlet();
            FakePackageRepository repository = fakeRegisteredPackageRepositories.FakePackageRepository;

            repository.AddFakePackage("A");
            FakePackage package = repository.AddFakePackage("B");

            repository.AddFakePackage("C");

            EnableListAvailableParameter();
            SetFilterParameter("B");
            RunCmdlet();

            List <object> actualPackages   = fakeCommandRuntime.ObjectsPassedToWriteObject;
            var           expectedPackages = new FakePackage[] {
                package
            };

            CollectionAssert.AreEqual(expectedPackages, actualPackages);
        }
        public void ProcessRecord_RecentPackagesRequested_RecentPackagesReturned()
        {
            CreateCmdlet();

            FakePackageRepository recentPackageRepository = fakeRegisteredPackageRepositories.FakeRecentPackageRepository;

            recentPackageRepository.AddFakePackage("A");

            EnableRecentParameter();
            RunCmdlet();

            List <object>      actualPackages   = fakeCommandRuntime.ObjectsPassedToWriteObject;
            List <FakePackage> expectedPackages = recentPackageRepository.FakePackages;

            Assert.AreEqual(expectedPackages, actualPackages);
        }
Exemple #8
0
        FakePackage AddRepositoryWithOnePackage(string packageId)
        {
            FakePackageRepository repository = AddRepository();

            return(repository.AddFakePackage(packageId));
        }