Use case – automating functional tests
In this section, we will add a simple functional test to the ASP.NET Core test project of Chapter 18, Testing Your Code with Unit Test Cases and TDD. Our test approach is based on the Microsoft.AspNetCore.Mvc.Testing
and AngleSharp
NuGet packages. Please make a new copy of the whole solution.
The test project already references the ASP.NET Core project under test
and all the required xUnit NuGet packages, so we need to add just the Microsoft.AspNetCore.Mvc.Testing
and AngleSharp
NuGet packages.
Now, let's add a new class file called UIExampleTest.cs
. We need using
statements to reference all the necessary namespaces. More specifically, we need the following:
using PackagesManagement;
: This is needed to reference your application classes.using Microsoft.AspNetCore.Mvc.Testing;
: This is needed to reference the client and server classes.using AngleSharp;
andusing AngleSharp.Html.Parser;
: These are needed...