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); }
/// <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("\\", "/")); }
public void BlobArtifactModelEquals_ReturnsFalseWhenObjectsAreDifferentTypes() { BlobArtifactModel blobArtifact = new BlobArtifactModel { Attributes = new Dictionary <string, string> { { "NonShipping", true.ToString().ToLower() }, }, Id = null }; Assert.False(blobArtifact.Equals("thisIsNotABlobArtifact!")); }
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)); }
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)); }
private ITaskItem CreateItem(BlobArtifactModel model) { return(new TaskItem("Blob", ArtifactMetadata(model.ToXml(), model.Attributes))); }