Do I need different module in each test case using Nancy?
<p>I want to test my web application, without the web services layer. in order to do that I am using Nancy framework.</p>

<p>I am mocking ServiceA as follow:</p>

<pre><code>public class ServiceAModule : NancyModule
{
    public ServiceAModule () : base("/serviceAPath")
    {
        Get["/"] = p =&gt;
        {
            var s = @"{Property1 : 23}";
            var jsonBytes = Encoding.UTF8.GetBytes(s);

            return new Response
            {
                ContentType = "application/json",
                Contents = stream =&gt; stream.Write(jsonBytes, 0, jsonBytes.Length),
                StatusCode = HttpStatusCode.OK
            };
        };
    }
</code></pre>

<p>Now, in my tests: I initialize Nancy service:</p>

<pre><code>    private static IDisposable CreateService()
    {
        const string url = "http://+:8088";

        var service = WebApp.Start(url, builder =&gt;
        {
            var browser = new Browser(with =&gt; { with.EnableAutoRegistration(); });

            builder.UseNancy();
        });

        return service;
    }
</code></pre>

<p>And I am testing the application UI using selenium.
My question is: I need different scenario (different response from ServiceAModule Get end point), what are my options?
As I see it, I have one option, which is to create different module for each test case and register this module on each test.
This solution brings a lot of code, and mess.</p>

<p>Do I have any other option? what is the common use of Nancy in this cases?</p>

<p>Thank you!</p>