public void AssetsAddedToList_NewAndPreviousAssetsInList()
        {
            AssetData existingAssetData = new AssetData(true)
            {
                Name      = "ExistingAssetName",
                Version   = "56789",
                Locations = ImmutableList <AssetLocationData> .Empty.Add(new AssetLocationData(LocationType.Container) { Location = "oldTestLocation" })
            };

            PushMetadataToBuildAssetRegistry pushMetadata = new PushMetadataToBuildAssetRegistry();
            List <AssetData> assetData = new List <AssetData>()
            {
                existingAssetData
            };

            AssetData newAssetData = new AssetData(true)
            {
                Name = "testName", Version = "12345", Locations = ImmutableList <AssetLocationData> .Empty.Add(new AssetLocationData(LocationType.None) { Location = "testLocation" })
            };

            pushMetadata.AddAsset(assetData, newAssetData.Name, newAssetData.Version, "testLocation", LocationType.None, true);
            assetData.Count.Should().Be(2);
            assetData[0].Should().BeEquivalentTo(existingAssetData);
            assetData[1].Should().BeEquivalentTo(newAssetData);
        }
        public void NullAssetList_ThrowsNullReferenceException()
        {
            PushMetadataToBuildAssetRegistry pushMetadata = new PushMetadataToBuildAssetRegistry();

            Action act = () =>
                         pushMetadata.AddAsset(null, "testName", "12345", "testLocation", LocationType.None, true);

            act.Should().Throw <NullReferenceException>();
        }
        public void EmptyAssetList_NewAssetIsOnlyAssetInList()
        {
            PushMetadataToBuildAssetRegistry pushMetadata = new PushMetadataToBuildAssetRegistry();
            List <AssetData> assetData         = new List <AssetData>();
            AssetData        expectedAssetData = new AssetData(true)
            {
                Name = "testName", Version = "12345", Locations = ImmutableList <AssetLocationData> .Empty.Add(new AssetLocationData(LocationType.None) { Location = "testLocation" })
            };

            pushMetadata.AddAsset(assetData, expectedAssetData.Name, expectedAssetData.Version, "testLocation", LocationType.None, true);
            assetData.Count.Should().Be(1);
            assetData.Should().BeEquivalentTo(expectedAssetData);
        }