简体   繁体   中英

Integration testing C# WebAPI asp.NET Framework 4.6.1

I am trying to write integration tests in C# for my C# asp.NET Framework 4.6.1 WebAPI which contains simple CRUD functionalities.

I have found little to no documentation on making automated integration tests for .NET Framework 4.6.1 using Microsoft.AspNet.WebApi 5.2.4. I've only found relatively old articles and video's on making integration tests for .NET Core using Xunit and Nunit, but ran into a lot of compatibility issues while trying to somehow make them work on .NET Framework 4.6.1 and WebApi 5.2.4.

I know this question could be considered primarily opinion based, but I would really appreciate any help on the matter.

How to write automated tests for an .NET Framework 4.6.1 Microsoft.AspNet.WebApi 5.2.4 application?

  • Which packages could I use?
  • How do I configure these packages properly?
  • How should I use these packages?

I currently do not use Owin for hosting my application, but invoke my configurations in Global.asax, but I could create a solution configuration which builds the project using Owin if needed.

After reading the comments it sounds like you're looking for owin TestServer.

https://www.strathweb.com/2012/06/asp-net-web-api-integration-testing-with-in-memory-hosting/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM