mardi 26 février 2019

SignalR Service mock implementation for Service/Integration testing

I want to be able to simulate SignalR Hub for services tests. The idea is to be able to create a test in the following way: Start a SignalR server (url, port and hub class should be configured at runtime) - the hub will be created in the test module for this purpose. So the first part - starting a runtime configurable SignalR server Is possible:

StartOptions so = new StartOptions("http://127.0.0.1:8080");
so.AppStartup = "SrServer.Startup1"; // set the startup class (will be defined in the test module)

The following is an example for Startup1:

class Startup1
{
    public void Configuration(IAppBuilder app)
    {

        app.UseCors(CorsOptions.AllowAll);
        app.MapSignalR();
    }
}

The only issue I'm missing is being able to set the hub to be used from my test module - is this possible?

Aucun commentaire:

Enregistrer un commentaire