public void BuildAssetsUtils_GenerateContentFilesItem_CopyToOutput_Flatten() { // Arrange var path = "contentFiles/cs/net46/a/b/c.txt"; var item = new LockFileContentFile(path); item.BuildAction = BuildAction.None; item.CodeLanguage = "cs"; item.CopyToOutput = true; item.OutputPath = "c.txt"; // Act var node = BuildAssetsUtils.GenerateContentFilesItem(path, item, "a", "1.0.0"); var metadata = node.Elements().ToDictionary(e => e.Name.LocalName, e => e.Value, StringComparer.OrdinalIgnoreCase); // Assert Assert.Equal("a", metadata["NuGetPackageId"]); Assert.Equal("1.0.0", metadata["NuGetPackageVersion"]); Assert.Equal("None", metadata["NuGetItemType"]); Assert.Equal("True", metadata["Private"]); Assert.Equal("c.txt", metadata["TargetPath"]); Assert.Equal("a/b/c.txt", metadata["Link"].Replace('\\', '/')); Assert.Equal("PreserveNewest", metadata["CopyToOutputDirectory"]); Assert.False(metadata.ContainsKey("DestinationSubDirectory")); }
public void BuildAssetsUtils_GenerateContentFilesItem_CompileAsset() { // Arrange var path = "contentFiles/cs/net46/test/test.cs"; var item = new LockFileContentFile(path); item.BuildAction = BuildAction.Compile; item.CodeLanguage = "cs"; // Act var node = BuildAssetsUtils.GenerateContentFilesItem(path, item, "a", "1.0.0"); var metadata = node.Elements().ToDictionary(e => e.Name.LocalName, e => e.Value, StringComparer.OrdinalIgnoreCase); // Assert Assert.Equal("a", metadata["NuGetPackageId"]); Assert.Equal("1.0.0", metadata["NuGetPackageVersion"]); Assert.Equal("Compile", metadata["NuGetItemType"]); Assert.Equal("False", metadata["Private"]); Assert.Equal("test/test.cs", metadata["Link"].Replace('\\', '/')); }