New: Multi target net framework 4.6.2 and net core 3.0

This commit is contained in:
ta264
2019-10-28 21:30:08 +00:00
parent 9f5dac3789
commit 4346c76d4f
99 changed files with 896 additions and 850 deletions
@@ -3,11 +3,12 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using FluentAssertions;
using Moq;
using Newtonsoft.Json;
using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
@@ -22,7 +23,7 @@ namespace NzbDrone.Core.Test.ParserTests
{
public class FingerPrintTest
{
public string RequestContent { get; set; }
public string Request { get; set; }
public string Response { get; set; }
}
@@ -30,7 +31,7 @@ namespace NzbDrone.Core.Test.ParserTests
public void UseAcoustidResponses()
{
// responses were generated by editing HttpClient to write out the content bytes as a string
// using BitConverter.ToString(request.ContentData)
// using System.Text.Encoding.UTF8.GetString(request.ContentData.Decompress());
var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Fingerprinting", "AcoustidResponses.json");
var responses = JsonConvert.DeserializeObject<List<FingerPrintTest>>(File.ReadAllText(path));
@@ -38,16 +39,13 @@ namespace NzbDrone.Core.Test.ParserTests
{
Mocker.GetMock<IHttpClient>()
.Setup(o => o.Post<LookupResponse>(
It.Is<HttpRequest>(v =>
v.Url.Equals(new HttpUri("https://api.acoustid.org/v2/lookup")) &&
v.Headers.Contains(new KeyValuePair<string, string>("Content-Encoding", "gzip")) &&
v.Headers.ContentType == "application/x-www-form-urlencoded" &&
// Skip past the first bit of gzip header which varies by OS:
// http://www.onicos.com/staff/iz/formats/gzip.html
BitConverter.ToString(v.ContentData).Substring(31) == response.RequestContent.Substring(31)
)))
It.Is<HttpRequest>(v =>
v.Url.Equals(new HttpUri("https://api.acoustid.org/v2/lookup")) &&
v.Headers.Contains(new KeyValuePair<string, string>("Content-Encoding", "gzip")) &&
v.Headers.ContentType == "application/x-www-form-urlencoded" &&
Encoding.UTF8.GetString(v.ContentData.Decompress()) == response.Request
)))
.Returns<HttpRequest>(r => new HttpResponse<LookupResponse>(new HttpResponse(r, new HttpHeader(), response.Response)));
}
}