public static TProfile LoadCurrentProfile <TProfile>() where TProfile : TestProfileBase, new() { TProfile result = null; var className = typeof(TProfile).Name; var machineProfileFileName = string.Format(@"SPMetaRegressionProfiles/{0}.{1}.xml", Environment.MachineName, className); if (File.Exists(machineProfileFileName)) { // pragmatic way var profileXml = File .ReadAllText(machineProfileFileName) .Replace("{$MachineName$}", Environment.MachineName); result = XmlSerializerUtils.DeserializeFromString <TProfile>(profileXml); } if (result != null) { return(result); } return(new TProfile()); }
private List <string> RestoreMappings() { var fileName = "regresion-mapping.txt"; var result = new List <string>(); if (File.Exists(fileName)) { var value = File.ReadAllText(fileName).Trim(); if (!string.IsNullOrEmpty(value)) { result = XmlSerializerUtils.DeserializeFromString <List <string> >(value); } } return(result); }
public static DocSample FromXml(string xml) { return(XmlSerializerUtils.DeserializeFromString <DocSample>(xml)); }