Updated to C# 12
This commit is contained in:
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
||||
using AMWD.Common.AspNetCore.Security.BasicAuthentication;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
|
||||
@@ -156,12 +157,16 @@ namespace UnitTests.AspNetCore.Security.BasicAuthentication
|
||||
var requestHeaderMock = new Mock<IHeaderDictionary>();
|
||||
foreach (var header in _requestHeaders)
|
||||
{
|
||||
var strVal = new StringValues(header.Value);
|
||||
requestHeaderMock
|
||||
.Setup(h => h.ContainsKey(header.Key))
|
||||
.Returns(true);
|
||||
requestHeaderMock
|
||||
.Setup(h => h[header.Key])
|
||||
.Returns(header.Value);
|
||||
.Returns(strVal);
|
||||
requestHeaderMock
|
||||
.Setup(h => h.TryGetValue(header.Key, out strVal))
|
||||
.Returns(true);
|
||||
}
|
||||
|
||||
var requestMock = new Mock<HttpRequest>();
|
||||
@@ -174,6 +179,11 @@ namespace UnitTests.AspNetCore.Security.BasicAuthentication
|
||||
responseHeaderMock
|
||||
.SetupSet(h => h[It.IsAny<string>()] = It.IsAny<StringValues>())
|
||||
.Callback<string, StringValues>((key, value) => _responseHeadersCallback[key] = value);
|
||||
#pragma warning disable CS0618
|
||||
responseHeaderMock
|
||||
.SetupSet(h => h.WWWAuthenticate)
|
||||
.Callback((value) => _responseHeadersCallback[HeaderNames.WWWAuthenticate] = value);
|
||||
#pragma warning restore CS0618
|
||||
|
||||
var responseMock = new Mock<HttpResponse>();
|
||||
responseMock
|
||||
|
||||
Reference in New Issue
Block a user