Esempio n. 1
0
        public void GivenAssetsInBlobSet()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            AssetData         dataInBlobSet     = pushMetadata.GetManifestAsAsset(ImmutableList.Create(nonShippingAssetData), "thisIsALocation", "thisIsTheManifestFileName");
            BlobArtifactModel blobArtifactModel = new BlobArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "NonShipping", "true" }
                },
                Id = dataInBlobSet.Name
            };

            expectedBuildModel.Artifacts =
                new ArtifactSet
            {
                Blobs = new List <BlobArtifactModel> {
                    blobArtifactModel
                }
            };
            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(
                ImmutableList.Create(dataInBlobSet), manifestBuildData);

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }
Esempio n. 2
0
        public void GivenShippingAssets()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            PackageArtifactModel packageArtifact = new PackageArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "NonShipping", "false" },
                },
                Id      = shippingAssetData.Name,
                Version = shippingAssetData.Version
            };

            expectedBuildModel.Artifacts =
                new ArtifactSet
            {
                Packages = new List <PackageArtifactModel> {
                    packageArtifact
                }
            };

            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(
                ImmutableList.Create(shippingAssetData), manifestBuildData);

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }
Esempio n. 3
0
        public void GivenAssetWithoutVersion()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            PackageArtifactModel packageArtifact = new PackageArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "NonShipping", "true" },
                    { "Id", assetDataWithoutVersion.Name },
                    { "Version", null }
                }
            };

            expectedBuildModel.Artifacts =
                new ArtifactSet
            {
                Packages = new List <PackageArtifactModel> {
                    packageArtifact
                }
            };

            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(
                ImmutableList.Create(assetDataWithoutVersion), manifestBuildData);

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }
        public void GivenShippingAndNonShippingPackagesBothShouldBeMergedIntoTheBuildModel()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            expectedBuildModel.Artifacts =
                new ArtifactSet
            {
                Packages = new List <PackageArtifactModel> {
                    shippingPackage, package1, packageWithNoVersion
                },
                Blobs = new List <BlobArtifactModel> {
                    blob1
                }
            };

            packages = new List <PackageArtifactModel>()
            {
                shippingPackage, package1, packageWithNoVersion
            };
            blobs = new List <BlobArtifactModel>()
            {
                blob1
            };
            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(packages, blobs, manifest);

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }
        public void CheckIfTheDataIsPreservedAfterMerging()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            expectedBuildModel.Artifacts =
                new ArtifactSet
            {
                Packages = new List <PackageArtifactModel> {
                    package1, nonShippingPackage
                },
                Blobs = new List <BlobArtifactModel> {
                    blob1, nonShippingBlob
                }
            };
            expectedBuildModel.Identity.IsStable = true;

            packages = new List <PackageArtifactModel>()
            {
                package1, nonShippingPackage
            };
            blobs = new List <BlobArtifactModel>()
            {
                blob1, nonShippingBlob
            };

            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(packages, blobs, manifest);

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }
Esempio n. 6
0
        public void GivenEmptyAssetsList()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(ImmutableList.Create <AssetData>(), manifestBuildData);

            expectedBuildModel.Artifacts = new ArtifactSet {
            };

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }
        public void CheckIfBlobDataIsPreservedAfterMerging()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            packages = new List <PackageArtifactModel>();
            blobs    = new List <BlobArtifactModel>();
            blobs.Add(blob1);

            expectedBuildModel.Artifacts =
                new ArtifactSet
            {
                Blobs = new List <BlobArtifactModel> {
                    blob1
                }
            };
            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(packages, blobs, manifest);

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }
        public void GivenMultipleBlobsAllShouldBeMergedIntoBuildModel()
        {
            BuildModel expectedBuildModel = GetBuildModel();
            PushMetadataToBuildAssetRegistry pushMetadata = GetPushMetadata();

            expectedBuildModel.Artifacts =
                new ArtifactSet
            {
                Blobs = new List <BlobArtifactModel> {
                    blob1, nonShippingBlob, mergedManifest, shippingBlob
                }
            };

            packages = new List <PackageArtifactModel>();
            blobs    = new List <BlobArtifactModel>()
            {
                blob1, nonShippingBlob, mergedManifest, shippingBlob
            };

            BuildModel actualModel = pushMetadata.CreateMergedManifestBuildModel(packages, blobs, manifest);

            actualModel.Should().BeEquivalentTo(expectedBuildModel);
        }