public void GetDownloadFileApplicationRequestGeneratesValidXml() { string customerUserId = "customerId"; X509Certificate2 certificate = GetX509Certificate2(); DanskeBankHandler danskeBankHandler = new DanskeBankHandler(customerUserId, certificate); XDocument documentXml = danskeBankHandler.GetDownloadFileApplicationRequestXml("fileReference_test", "test System"); string xmlString = documentXml.ToString(); Console.Out.WriteLine(xmlString); }
public void DownloadFileApplicationRequestCanEncryptData() { string customerUserId = "customerId"; X509Certificate2 certificate = GetX509Certificate2(); DanskeBankHandler danskeBankHandler = new DanskeBankHandler(customerUserId, certificate); XDocument documentXml = danskeBankHandler.GetDownloadFileApplicationRequestXml("fileReference_test", "test System"); XDocument encryptedXml = danskeBankHandler.EncryptApplicationRequest(certificate, documentXml); XDocument decryptedXml = danskeBankHandler.DecryptApplicationRequest(certificate, encryptedXml); //Console.Out.WriteLine(encryptedXml); //Console.Out.WriteLine(decryptedXml); Assert.AreEqual(documentXml.ToString(), decryptedXml.ToString()); }
public void DownloadFile() { string customerUserId = "customerId"; X509Certificate2 certificate = GetX509Certificate2(); InterfaceHelper initializer = InterfaceHelper.GetInstance(); initializer.AllowThumbprint("e4bc48303644882ce5c6b39434d553e951de14f8"); System.Diagnostics.Trace.AutoFlush = true; TraceSource mySource = new TraceSource("System.ServiceModel", SourceLevels.All); //mySource.Switch = new SourceSwitch("sourceSwitch", "Error"); //mySource.Listeners.Remove("Default"); //mySource.Listeners. //TextWriterTraceListener textListener = new TextWriterTraceListener("myListener.log"); ConsoleTraceListener console = new ConsoleTraceListener(false); console.Filter = new EventTypeFilter(SourceLevels.All); console.Name = "console"; //textListener.Filter = new EventTypeFilter(SourceLevels.Error); mySource.Listeners.Add(console); //mySource.Listeners.Add(textListener); // Allow the trace source to send messages to // listeners for all event types. Currently only // error messages or higher go to the listeners. // Messages must get past the source switch to // get to the listeners, regardless of the settings // for the listeners. mySource.Switch.Level = SourceLevels.All; DanskeBankHandler danskeBankHandler = new DanskeBankHandler(customerUserId, certificate); mySource.TraceEvent(TraceEventType.Error, 1, "Error message."); // Set the filter settings for the // console trace listener. mySource.Listeners["console"].Filter = new EventTypeFilter(SourceLevels.Critical); //Activity2(); // Change the filter settings for the console trace listener. mySource.Listeners["console"].Filter = new EventTypeFilter(SourceLevels.Information); //Activity3(); //Trace. mySource.Close(); //System.Diagnostics.TraceSource traceSource = new System.Diagnostics.TraceSource() //System.Diagnostics.lis /* * * * <system.diagnostics> * <trace autoflush="true" /> * <sources> * <source name="System.ServiceModel" * switchValue="Information, ActivityTracing" * propagateActivity="true"> * <listeners> * <add name="sdt" * type="System.Diagnostics.XmlWriterTraceListener" * initializeData= "SdrConfigExample.e2e" /> * </listeners> * </source> * </sources> * </system.diagnostics> * */ XDocument documentXml = danskeBankHandler.DownloadIso20022("fileReference_test", "test System"); string xmlString = documentXml.ToString(); Console.Out.WriteLine(xmlString); }