lundi 2 septembre 2019

How to identify when my code is testing in C#?

I am having troubles when testing a controller, because there are some lines at my Startup that are null when testing, I want to add a condition for run this lines only if it's not testing.

// Desired method that retrieves if testing
if (!this.isTesting())
{
  SwaggerConfig.ConfigureServices(services, this.AuthConfiguration, this.ApiMetadata.Version);
}

Aucun commentaire:

Enregistrer un commentaire