-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* extended output on failed verapdf execution * fixed error message creation code * fixed linux testsetup * nonfunctional changes * dropped things that didnt do anything * dropped unused variable * Added notes about dependencies * Moved forward to async implementation, Fixed some compile warnings * Updated ubuntu 20.04 cook book * Major version increased * Added integrative test * Enabled dependency injection in webapp * upgraded nuget references
- Loading branch information
Showing
10 changed files
with
123 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using Microsoft.AspNetCore.Mvc.Testing; | ||
using System; | ||
using System.IO; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace CodeuctivityWebApiTest | ||
{ | ||
public class IntegrativeTests : IClassFixture<WebApplicationFactory<CodeuctivityWebApi.Startup>> | ||
{ | ||
private readonly WebApplicationFactory<CodeuctivityWebApi.Startup> _factory; | ||
|
||
public IntegrativeTests(WebApplicationFactory<CodeuctivityWebApi.Startup> factory) | ||
{ | ||
_factory = factory; | ||
} | ||
|
||
[Theory] | ||
[InlineData("/", "text/html; charset=utf-8")] | ||
[InlineData("/swagger/v1/swagger.json", "application/json; charset=utf-8")] | ||
public async Task ShouldAccessEndpointSuccessfull(string route, string contentType) | ||
{ | ||
// Arrange | ||
var client = _factory.CreateClient(); | ||
var expectedUrl = new Uri($"https://localhost{route}"); | ||
|
||
// Act | ||
var response = await client.GetAsync(expectedUrl).ConfigureAwait(false); | ||
|
||
// Assert | ||
response.EnsureSuccessStatusCode(); | ||
Assert.Equal(contentType, response.Content.Headers.ContentType.ToString()); | ||
} | ||
|
||
[Fact] | ||
public async Task ShouldValidatePdf() | ||
{ | ||
// Arrange | ||
var client = _factory.CreateClient(); | ||
using var request = new HttpRequestMessage(new HttpMethod("POST"), "http://localhost/api/PdfAValidator"); | ||
using var file = new ByteArrayContent(File.ReadAllBytes("../../../FromLibreOffice.pdf")); | ||
file.Headers.Add("Content-Type", "application/pdf"); | ||
var multipartContent = new MultipartFormDataContent(); | ||
multipartContent.Add(file, "pdfFile", Path.GetFileName("FromLibreOffice.pdf")); | ||
request.Content = multipartContent; | ||
|
||
// Act | ||
var response = await client.SendAsync(request).ConfigureAwait(false); | ||
|
||
// Assert | ||
response.EnsureSuccessStatusCode(); | ||
Assert.Equal("true", await response.Content.ReadAsStringAsync().ConfigureAwait(false)); | ||
} | ||
|
||
[Fact] | ||
public async Task ShouldValidatePdfDetailedReport() | ||
{ | ||
// Arrange | ||
var client = _factory.CreateClient(); | ||
using var request = new HttpRequestMessage(new HttpMethod("POST"), "http://localhost/api/PdfAValidator/DetailedReport"); | ||
using var file = new ByteArrayContent(File.ReadAllBytes("../../../FromLibreOffice.pdf")); | ||
file.Headers.Add("Content-Type", "application/pdf"); | ||
var multipartContent = new MultipartFormDataContent(); | ||
multipartContent.Add(file, "pdfFile", Path.GetFileName("FromLibreOffice.pdf")); | ||
request.Content = multipartContent; | ||
|
||
// Act | ||
var response = await client.SendAsync(request).ConfigureAwait(false); | ||
// Assert | ||
response.EnsureSuccessStatusCode(); | ||
|
||
string actual = await response.Content.ReadAsStringAsync().ConfigureAwait(false); | ||
Assert.Contains("isCompliant\":true", actual); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
regex='PackageReference Include="([^"]*)" Version="([^"]*)"' | ||
find . -name "*.*proj" | while read proj | ||
do | ||
while read line | ||
do | ||
if [[ $line =~ $regex ]] | ||
then | ||
name="${BASH_REMATCH[1]}" | ||
version="${BASH_REMATCH[2]}" | ||
if [[ $version != *-* ]] | ||
then | ||
dotnet add $proj package $name | ||
fi | ||
fi | ||
done < $proj | ||
done |