0

how can I mock the HttpContext GetTokenAsync to return a string?

var token = await HttpContext.GetTokenAsync("access_token");

I tried this based on what I found on the internet :

var authenticationServiceStub = new Mock<IAuthenticationService>();

authenticationServiceStub 
    .Setup(x => x.GetTokenAsync(It.IsAny<string>()))
    .ReturnsAsync("value");

I can select "x.GetTokenAsync" but I get the message :

IAuthenticationService does not contain a definition for 'GetTokenAsync'...

What am I missing?

0 Answers0