public void GetComplianceUrlTest() { string destination = "test.htm"; string username = "******"; string description = "this & is a test description"; int timestamp = HL7AuthHelper.GetTimestamp(); string requestHash = string.Format("{0}|{1}|{2}|{3}", username, destination, timestamp, Trifolia.Config.AppSettings.HL7ApiKey); string expected = string.Format( "{0}?userid={1}&returnURL={2}&signingURL={2}&signingDescription={3}&requestHash={4}×tampUTCEpoch={5}&apiKey={6}", "http://hl7.amg-hq.net/temp/mike/webservices/compliance_redirect.cfm", username, destination, "this+%26+is+a+test+description", HL7AuthHelper.GetEncrypted(requestHash, Trifolia.Config.AppSettings.HL7SharedKey), timestamp, Trifolia.Config.AppSettings.HL7ApiKey); string actual = HL7AuthHelper.GetComplianceUrl(destination, username, description, timestamp); Assert.AreEqual(expected, actual); }
public void GetTimestampTest() { TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); int expected = (int)t.TotalSeconds; int actual = HL7AuthHelper.GetTimestamp(); Assert.AreEqual(expected, actual); }