public void FakesDataCollectorSettingsShouldBeInserted() { string runSettingsXml = @"<RunSettings><RunConfiguration></RunConfiguration></RunSettings>"; var doc = new XmlDocument(); using (var xmlReader = XmlReader.Create( new StringReader(runSettingsXml), new XmlReaderSettings() { CloseInput = true })) { doc.Load(xmlReader); } var dataCollectorNode2 = new DataCollectorSettings() { AssemblyQualifiedName = FakesUtilities.FakesMetadata.DataCollectorAssemblyQualifiedName, Uri = new Uri(FakesUtilities.FakesMetadata.DataCollectorUriV2), FriendlyName = FakesUtilities.FakesMetadata.FriendlyName, IsEnabled = true, Configuration = doc.FirstChild as XmlElement }; FakesUtilities.InsertOrReplaceFakesDataCollectorNode(doc, dataCollectorNode2); Assert.IsTrue(XmlRunSettingsUtilities.ContainsDataCollector(doc, FakesUtilities.FakesMetadata.DataCollectorUriV2)); }
public void OtherRunsettingsShouldNotBeChanged() { string runSettingsXml = @"<RunSettings><RunConfiguration><TargetFrameworkVersion>FrameworkCore10</TargetFrameworkVersion></RunConfiguration></RunSettings>"; var doc = new XmlDocument(); using (var xmlReader = XmlReader.Create( new StringReader(runSettingsXml), new XmlReaderSettings() { CloseInput = true })) { doc.Load(xmlReader); } var dataCollectorNode2 = new DataCollectorSettings() { AssemblyQualifiedName = FakesUtilities.FakesMetadata.DataCollectorAssemblyQualifiedName, Uri = new Uri(FakesUtilities.FakesMetadata.DataCollectorUriV2), FriendlyName = FakesUtilities.FakesMetadata.FriendlyName, IsEnabled = true, Configuration = doc.CreateElement("Configuration") }; FakesUtilities.InsertOrReplaceFakesDataCollectorNode(doc, dataCollectorNode2); Assert.IsTrue(XmlRunSettingsUtilities.ContainsDataCollector(doc, FakesUtilities.FakesMetadata.DataCollectorUriV2)); XmlNodeList nodes = doc.SelectNodes("//RunSettings/RunConfiguration/TargetFrameworkVersion"); Assert.AreEqual("FrameworkCore10", nodes[0].InnerText); }