/// <summary> /// Deserialize XML string into XSD generated SECURE code /// </summary> /// <typeparam name="T">Type of object to be deserialized into</typeparam> /// <param name="xml">string, containing the XML data</param> /// <param name="validation">bool, true to enable validation during deserialization</param> /// <returns>object of Type T with data from the XML string</returns> public static T DeserializeXML <T>(string xml, bool validation) { return(TestController.DeserializeXML <T>( xml, Properties.Resources.SECURE_XML_Schema, (System.IO.Directory.GetCurrentDirectory() + "\\XML\\SECURE.xsd"), validation)); } /// <summary>
/// <summary> /// Perform Login operation asynchronously /// </summary> /// <param name="mediaType">MediaType, enumeration defining the media type of the http operation</param> /// <param name="username">string, containing the username</param> /// <param name="password">string, containing the password</param> /// <returns>string, containing the complete text of the HTTP response/returns> public async Task <string> LoginAsync(string username, string password, string twoFactorPassword, bool enableValidation) { string responseText = await this.SECURE_API_Async( Properties.Resources.MediaType_XML, HTTP.PUT, new string[] { "Authentication", "Login" }, null, new StringContent( TestController.SerializeXML(new AuthenticationDetail() { UserName = username, Password = password, TwoFactorPassword = twoFactorPassword }))); if (this.Last_HTTPstatus == (int)HttpStatusCode.OK || this.Last_HTTPstatus == (int)HttpStatusCode.Accepted) { this.Session = TestController.DeserializeXML <SessionDetail>(responseText, enableValidation); } return(responseText); }
} /// <summary> /// Deserialize XML string into XSD generated SECURE code /// </summary> /// <typeparam name="T">Type of object to be deserialized into</typeparam> /// <param name="xml">string, containing the XML data</param> /// <returns>object of Type T with data from the XML string</returns> public static T DeserializeXML <T>(string xml) { return(TestController.DeserializeXML <T>(xml, true)); }