Skip to content

Commit

Permalink
Merge pull request #83 from Codeuctivity/main
Browse files Browse the repository at this point in the history
Aligned webapi things
  • Loading branch information
stesee authored May 13, 2023
2 parents e9bfd0d + d54f93e commit f20758e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions PdfAValidator/PdfAValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,11 @@ private static void ValidateVeraPdfOutputToBeXml(string outputResult, string? cu
private static T DeserializeXml<T>(string sourceXML) where T : class
{
var settings = new XmlReaderSettings();
var serializer = new XmlSerializer(typeof(T));
var xmlSerializer = new XmlSerializer(typeof(T));

using var reader = new StringReader(sourceXML);
using var xmlReader = XmlReader.Create(reader, settings);
return (T)serializer.Deserialize(xmlReader);
return (T)xmlSerializer.Deserialize(xmlReader);
}

private async Task IntiPathToVeraPdfBinAndJava()
Expand Down
14 changes: 10 additions & 4 deletions PdfAValidatorWebApiTest/IntegrativeTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using Codeuctivity;
using Codeuctivity.PdfAValidatorWebApi;
using Microsoft.AspNetCore.Mvc.Testing;
using PdfAValidatorWebApi;
using System;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using Xunit;

Expand Down Expand Up @@ -55,8 +54,15 @@ public async Task ShouldDownloadOpenApiDescription()
// use to update reference
// await File.WriteAllTextAsync("../../../OpenApi.json", actual);

var assembly = Assembly.LoadFrom("PdfAValidatorWebApiTest.dll");
var expected = File.ReadAllText("../../../OpenApi.json").Replace("PdfAValidator 0.0.1.0", $"PdfAValidator {assembly.GetName().Version}");
AssertOpenApiJsonEqualsExpected(actual);
}

private static void AssertOpenApiJsonEqualsExpected(string actual)
{
var assemblyVersion = typeof(Program).Assembly.GetName().Version;
var expected = File.ReadAllText("../../../OpenApi.json").Replace("PdfAValidator 0.0.1.0", $"PdfAValidator {assemblyVersion}");
expected = expected.ReplaceLineEndings();
actual = actual.ReplaceLineEndings();
Assert.Equal(expected, actual);
}

Expand Down
2 changes: 1 addition & 1 deletion PdfAValidatorWebApiTest/OpenApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"

namespace Codeuctivity
namespace Codeuctivity.PdfAValidatorWebApi
{
using System = global::System;

Expand Down

0 comments on commit f20758e

Please sign in to comment.