I am writing a unit test where I need to set the URL of the incoming request in order evaluate the URL inside the controller's method. I am using FakeItEasy and NUnit3.
Here is the code under test and the relevant part:
[HttpPost]
public async Task<IActionResult> Login(LoginViewModel loginViewModel)
{
...
var queryString = Uri.UnescapeDataString(Request.Query["returnUrl"]);
...
}
I want to set queryString to a value I specify in my unit test. Can someone help me with example code? The system under test is the controller. I can only seem to find Moq related code. Seems simple enough.