Пример #1
0
            public void OrderedByDownloadCountFirst()
            {
                var packageA = new MockPackage {
                    Id = "A", DownloadCount = 1
                };
                var packageB = new MockPackage {
                    Id = "B", DownloadCount = 2
                };

                var mockRepo = new MockPackageRepository();

                mockRepo.AddPackage(packageA);
                mockRepo.AddPackage(packageB);

                Dependencies.NuGetProjectManagerFactory = MockGenerator.CreateProjectManagerFactory(MockGenerator.CreateMockProjectManager(mockRepo, new MockPackageRepository()).Object);

                // act
                var project = new WebNuGetProject(new string[] { "http://dummyFeed" }, @"C:\DummyPath", null, MockGenerator.CreateWebProjectSystemFactory());
                var results = project.GetRemotePackages("");

                Assert.Equal(new IPackage[] { packageB, packageA }, results);

                packageA.DownloadCount = 2;

                results = project.GetRemotePackages("");
                Assert.Equal(new IPackage[] { packageA, packageB }, results);
            }
Пример #2
0
            public void DoesNotReturnPackagesFromLocal()
            {
                var packageA = new MockPackage {
                    Id = "A"
                };
                var packageB = new MockPackage {
                    Id = "B"
                };
                var packageAB = new MockPackage {
                    Id = "AB"
                };

                var mockRemoteRepo = new MockPackageRepository();

                mockRemoteRepo.AddPackage(packageA);
                mockRemoteRepo.AddPackage(packageB);
                var mockLocalRepo = new MockPackageRepository();

                mockLocalRepo.AddPackage(packageAB);

                Dependencies.NuGetProjectManagerFactory = MockGenerator.CreateProjectManagerFactory(MockGenerator.CreateMockProjectManager(mockRemoteRepo, mockLocalRepo).Object);

                // act
                var project = new WebNuGetProject(new string[] { "http://dummyFeed" }, @"C:\DummyPath", null, MockGenerator.CreateWebProjectSystemFactory());
                var results = project.GetRemotePackages("A");

                Assert.Equal(new IPackage[] { packageA }, results);
            }