public async Task WillNotIncludeThePackageWhenItDependsOnAPackageThatIsNotIncluded()
            {
                var stubFeed           = new CuratedFeed();
                var stubNuGetPackage   = CreateStubNuGetPackageReader();
                var stubGalleryPackage = CreateStubGalleryPackage();

                stubGalleryPackage.Dependencies.Add(
                    new PackageDependency {
                    Id = "NotACuratedPackage"
                });

                var curator = TestableWebMatrixPackageCurator.Create(stubCuratedFeedService =>
                {
                    stubCuratedFeedService.Setup(stub => stub.GetFeedByName(It.IsAny <string>(), It.IsAny <bool>())).Returns(stubFeed);
                });

                await curator.CurateAsync(stubGalleryPackage, stubNuGetPackage.Object, commitChanges : true);

                curator.StubCuratedFeedService.Verify(
                    stub => stub.CreatedCuratedPackageAsync(
                        It.IsAny <CuratedFeed>(),
                        It.IsAny <PackageRegistration>(),
                        It.IsAny <bool>(),
                        It.IsAny <bool>(),
                        It.IsAny <string>(),
                        It.IsAny <bool>()),
                    Times.Never());
            }
            public void WillNotExamineTheNuGetPackageFilesWhenTaggedWithAspNetWebPages()
            {
                var curator            = TestableWebMatrixPackageCurator.Create(null);
                var stubGalleryPackage = CreateStubGalleryPackage();
                var stubNuGetPackage   = CreateStubNuGetPackage();

                stubGalleryPackage.Tags = "aTag aspnetwebpages aThirdTag";

                curator.Curate(stubGalleryPackage, stubNuGetPackage.Object, commitChanges: true);

                stubNuGetPackage.Verify(stub => stub.GetFiles(), Times.Never());
            }
Esempio n. 3
0
            public void WillNotExamineTheNuGetPackageFilesWhenTaggedWithAspNetWebPages()
            {
                var curator                = TestableWebMatrixPackageCurator.Create(null);
                var stubGalleryPackage     = CreateStubGalleryPackage();
                var stubNuGetPackageReader = CreateStubNuGetPackageReader();

                stubGalleryPackage.Tags = "aTag aspnetwebpages aThirdTag";

                curator.Curate(stubGalleryPackage, stubNuGetPackageReader.Object, commitChanges: true);

                // at most once - reading the NuSpec will call GetFiles() under the hood
                stubNuGetPackageReader.Verify(stub => stub.GetFiles(), Times.AtMostOnce());
            }
Esempio n. 4
0
            public void WillSetTheAutomaticBitWhenIncludingThePackage()
            {
                var curator = TestableWebMatrixPackageCurator.Create(null);

                curator.Curate(CreateStubGalleryPackage(), CreateStubNuGetPackageReader().Object, commitChanges: true);

                curator.StubCuratedFeedService.Verify(
                    stub => stub.CreatedCuratedPackage(
                        It.IsAny <CuratedFeed>(),
                        It.IsAny <PackageRegistration>(),
                        It.IsAny <bool>(),
                        true,
                        null,
                        It.IsAny <bool>()));
            }
Esempio n. 5
0
            public void WillIncludeThePackageUsingTheCuratedFeedKey()
            {
                var curator = TestableWebMatrixPackageCurator.Create(null);

                curator.StubCuratedFeed.Key = 42;

                curator.Curate(CreateStubGalleryPackage(), CreateStubNuGetPackageReader().Object, commitChanges: true);

                curator.StubCuratedFeedService.Verify(
                    stub => stub.CreatedCuratedPackage(
                        curator.StubCuratedFeed,
                        It.IsAny <PackageRegistration>(),
                        It.IsAny <bool>(),
                        It.IsAny <bool>(),
                        null,
                        It.IsAny <bool>()));
            }
            public async Task WillIncludeThePackageUsingThePackageRegistrationKey()
            {
                var curator            = TestableWebMatrixPackageCurator.Create(null);
                var stubGalleryPackage = CreateStubGalleryPackage();

                stubGalleryPackage.PackageRegistration.Key = 42;

                await curator.CurateAsync(stubGalleryPackage, CreateStubNuGetPackageReader().Object, commitChanges : true);

                curator.StubCuratedFeedService.Verify(
                    stub => stub.CreatedCuratedPackageAsync(
                        It.IsAny <CuratedFeed>(),
                        stubGalleryPackage.PackageRegistration,
                        It.IsAny <bool>(),
                        It.IsAny <bool>(),
                        null,
                        It.IsAny <bool>()));
            }
Esempio n. 7
0
            public void WillNotIncludeThePackageWhenTheWebMatrixCuratedFeedDoesNotExist()
            {
                var curator = TestableWebMatrixPackageCurator.Create(stubCuratedFeedService =>
                {
                    stubCuratedFeedService.Setup(stub => stub.GetFeedByName(It.IsAny <string>(), It.IsAny <bool>())).Returns((CuratedFeed)null);
                });

                curator.Curate(CreateStubGalleryPackage(), null, commitChanges: true);

                curator.StubCuratedFeedService.Verify(
                    stub => stub.CreatedCuratedPackage(
                        It.IsAny <CuratedFeed>(),
                        It.IsAny <PackageRegistration>(),
                        It.IsAny <bool>(),
                        It.IsAny <bool>(),
                        It.IsAny <string>(),
                        It.IsAny <bool>()),
                    Times.Never());
            }