public void TestReferenceWithNoMetadataNoBuildInProjectAttribute() { // Test the case where the metadata is missing and we are not supposed to build the reference ITaskItem referenceItem = new TaskItem("TestItem"); XmlDocument doc = new XmlDocument(); XmlElement element = doc.CreateElement("TestElement"); AssignProjectConfiguration.SetBuildInProjectAndReferenceOutputAssemblyMetadata(true, referenceItem, element); Assert.Empty(referenceItem.GetMetadata("BuildReference")); Assert.Empty(referenceItem.GetMetadata("ReferenceOutputAssembly")); }
public void TestReferenceWithNoMetadataBuildInProjectAttributeFalseReferenceAndBuildProjectsDisabledInProjectConfiguration() { // Test the case where the metadata is missing and we are not supposed to build the reference ITaskItem referenceItem = new TaskItem("TestItem"); XmlDocument doc = new XmlDocument(); XmlElement element = doc.CreateElement("TestElement"); element.SetAttribute("BuildProjectInSolution", "false"); AssignProjectConfiguration.SetBuildInProjectAndReferenceOutputAssemblyMetadata(false, referenceItem, element); Assert.IsTrue(referenceItem.GetMetadata("BuildReference").Length == 0); Assert.IsTrue(referenceItem.GetMetadata("ReferenceOutputAssembly").Length == 0); }
public void TestReferenceWithNoMetadataBuildInProjectAttributeFalse() { // Test the case where the metadata is missing and we are not supposed to build the reference ITaskItem referenceItem = new TaskItem("TestItem"); XmlDocument doc = new XmlDocument(); XmlElement element = doc.CreateElement("TestElement"); element.SetAttribute("BuildProjectInSolution", "false"); AssignProjectConfiguration.SetBuildInProjectAndReferenceOutputAssemblyMetadata(true, referenceItem, element); Assert.IsTrue(referenceItem.GetMetadata("BuildReference").Equals("false", StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(referenceItem.GetMetadata("ReferenceOutputAssembly").Equals("false", StringComparison.OrdinalIgnoreCase)); }
public void TestReferenceWithNoMetadataBadBuildInProjectAttribute() { // Test the case where the metadata is missing and we are not supposed to build the reference ITaskItem referenceItem = new TaskItem("TestItem"); XmlDocument doc = new XmlDocument(); XmlElement element = doc.CreateElement("TestElement"); element.SetAttribute("BuildProjectInSolution", "IAmReallyABadOne"); AssignProjectConfiguration.SetBuildInProjectAndReferenceOutputAssemblyMetadata(true, referenceItem, element); Assert.Equal(0, referenceItem.GetMetadata("BuildReference").Length); Assert.Equal(0, referenceItem.GetMetadata("ReferenceOutputAssembly").Length); }
public void TestReferenceWithMetadataAlreadySetBuildInProjectAttributeFalse() { // Test the case where the metadata is missing and we are not supposed to build the reference ITaskItem referenceItem = new TaskItem("TestItem"); referenceItem.SetMetadata("BuildReference", "true"); referenceItem.SetMetadata("ReferenceOutputAssembly", "true"); XmlDocument doc = new XmlDocument(); XmlElement element = doc.CreateElement("TestElement"); element.SetAttribute("BuildProjectInSolution", "false"); AssignProjectConfiguration.SetBuildInProjectAndReferenceOutputAssemblyMetadata(true, referenceItem, element); Assert.Equal("true", referenceItem.GetMetadata("BuildReference")); Assert.Equal("true", referenceItem.GetMetadata("ReferenceOutputAssembly")); // Test the case where only ReferenceOutputAssembly is not set referenceItem = new TaskItem("TestItem"); referenceItem.SetMetadata("BuildReference", "true"); doc = new XmlDocument(); element = doc.CreateElement("TestElement"); element.SetAttribute("BuildProjectInSolution", "false"); AssignProjectConfiguration.SetBuildInProjectAndReferenceOutputAssemblyMetadata(true, referenceItem, element); Assert.Equal("true", referenceItem.GetMetadata("BuildReference")); Assert.Equal("false", referenceItem.GetMetadata("ReferenceOutputAssembly")); // Test the case where only BuildReference is not set referenceItem = new TaskItem("TestItem"); referenceItem.SetMetadata("ReferenceOutputAssembly", "true"); doc = new XmlDocument(); element = doc.CreateElement("TestElement"); element.SetAttribute("BuildProjectInSolution", "false"); AssignProjectConfiguration.SetBuildInProjectAndReferenceOutputAssemblyMetadata(true, referenceItem, element); Assert.Equal("false", referenceItem.GetMetadata("BuildReference")); Assert.Equal("true", referenceItem.GetMetadata("ReferenceOutputAssembly")); }