コード例 #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);
        }
コード例 #2
0
        /// <summary>
        ///     Get the short url for a blob.
        /// </summary>
        /// <param name="feedConfig">Feed configuration</param>
        /// <param name="blob">Blob</param>
        /// <returns>Short url prefix for the blob.</returns>
        /// <remarks>
        public string GetLatestShortUrlForBlob(TargetFeedConfig feedConfig, BlobArtifactModel blob, bool flatten)
        {
            string blobIdWithoutVersions = VersionIdentifier.RemoveVersions(blob.Id);

            if (flatten)
            {
                blobIdWithoutVersions = Path.GetFileName(blobIdWithoutVersions);
            }

            return(Path.Combine(feedConfig.LatestLinkShortUrlPrefix, blobIdWithoutVersions).Replace("\\", "/"));
        }
コード例 #3
0
        public void BlobArtifactModelEquals_ReturnsFalseWhenObjectsAreDifferentTypes()
        {
            BlobArtifactModel blobArtifact = new BlobArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "NonShipping", true.ToString().ToLower() },
                },
                Id = null
            };

            Assert.False(blobArtifact.Equals("thisIsNotABlobArtifact!"));
        }
コード例 #4
0
        public void BlobArtifactModelEquals_ReturnsTrueWhenMatchingAttributesAreNull()
        {
            BlobArtifactModel blobArtifact = new BlobArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "NonShipping", true.ToString().ToLower() },
                },
                Id = null
            };

            BlobArtifactModel otherBlobArtifact = new BlobArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "NonShipping", true.ToString().ToLower() },
                },
                Id = null
            };

            Assert.True(blobArtifact.Equals(otherBlobArtifact));
        }
コード例 #5
0
        public void BlobArtifactModelEquals_ReturnsFalseWhenTwoObjectsDoNotHaveMatchingAttributes()
        {
            BlobArtifactModel blobArtifact = new BlobArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "Shipping", true.ToString().ToLower() },
                },
                Id = "AssetName"
            };

            BlobArtifactModel otherBlobArtifact = new BlobArtifactModel
            {
                Attributes = new Dictionary <string, string>
                {
                    { "NonShipping", true.ToString().ToLower() },
                },
                Id = "AssetName"
            };

            Assert.False(blobArtifact.Equals(otherBlobArtifact));
        }
コード例 #6
0
 private ITaskItem CreateItem(BlobArtifactModel model)
 {
     return(new TaskItem("Blob", ArtifactMetadata(model.ToXml(), model.Attributes)));
 }