public FormsIntegrityUtility(IGenerateSignature signature, string signaturePlaceholder) { this.signature = signature; this.signaturePlaceholder = signaturePlaceholder; }
private static void AssertProtectingFormCreatesExpectedXml(string originalXml, string expectedXml, IGenerateSignature signature) { using (var streamIn = new MemoryStream()) { using (var streamOut = new MemoryStream()) { var writer = new StreamWriter(streamIn); writer.Write(originalXml); writer.Flush(); var formProtection = new FormsIntegrityUtility(signature, "PLACEHOLDER"); formProtection.SignForms(streamIn, streamOut); streamOut.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(streamOut)) { var xmlOut = reader.ReadToEnd(); Assert.AreEqual(expectedXml, xmlOut); } } } }