user584018
user584018

Reputation: 11304

How to write unit test for Program and Startup cs file for ASP.NET Core Web API app

Is there any ways to write unit test for Program cs file for ASP.NET Core Web API and similarly for startup class, just to show more code coverage for the entire app? It's shows 0% coverage for now.

enter image description here

Upvotes: 1

Views: 3480

Answers (1)

Priyanshu Parate
Priyanshu Parate

Reputation: 59

you can extract the configuration out in separate calls and expose them into func<> which is you are custom created and write the unit test for them . TIt is not recommended to test the framework code. you should do testing for your code only not for the framework. I hope you get the point correctly.

Upvotes: 2

Related Questions