c# - stub webserver for integration testing -


I have some integration tests, where I want to verify certain requirements, against a third [Artist webserver] I I was thinking that I would replace a third party server with a stub server which simply log calls made to it. Calls do not have to be successful, but I need records of requested requests (mainly just path + QuickString).

I was thinking of using IIS for this. I can set 1) an empty site, 2) Modify the system's host file to redirect requests to that site 3) Pars the log file at the end of each exam.

This is problematic for IIS. Log files are not written immediately, and files are written in constant words. I will need to read the material before detection, test the file, wait for a nodetemnic amount of time after the test, read the update material and more.

Can anyone think in a simple way?

You can use System.Net.HttpListener ().

It works as embedded webserver, which means that you can also check the use of on-the-fly without parsing the log files.

The categories used in your code recently:

  class listener {private HttpListener listener = null; Public Event EventHandler Command Reaction; Public Listener () {this.listener = New HttpListener (); This.listener.Prefixes.Add ("http: // localhost: 12345 /"); } Received Public Zero References (IAsync Results Result) {If (! This.listener.IsListening) {Return; } HttpListenerContext Reference = this.listener.EndGetContext (Results); This.listener.BeginGetContext (This is referenced, this .lister); If (context! = Null) {EventHandler handler = this.CommandReceived; Handler (context, new eventArg); }} Public Zero Start () {this.listener.Start (); This.listener.BeginGetContext (This is referenced, this .lister); } Public Zero Stop () {this.listener.Stop (); }}  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -