Skip to content

Commit

Permalink
Merge branch 'net8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
peters committed Jan 27, 2024
2 parents a518f56 + 12d2c77 commit b2fb26c
Show file tree
Hide file tree
Showing 307 changed files with 6,608 additions and 19,345 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@ on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.101
- name: Print openssl version
run: |
openssl version
- name: Decrypt signing key to use for strong-name
env:
SIGNINGKEY_ENC_PASSWORD: ${{ secrets.signingkeyEncPassword }}
run: |
openssl aes-256-cbc -salt -pbkdf2 -k "$SIGNINGKEY_ENC_PASSWORD" -in signingkey.snk.enc -out signingkey.snk -d
dotnet-version: |
6.0.418
8.0.1
- name: Install dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test --no-restore --verbosity normal
80 changes: 0 additions & 80 deletions .github/workflows/release.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .idea/.idea.digipost-api-client/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 19 additions & 20 deletions Digipost.Api.Client.Archive.Tests/ArchiveTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@
using Digipost.Api.Client.Common.Entrypoint;
using Xunit;

namespace Digipost.Api.Client.Archive.Tests
namespace Digipost.Api.Client.Archive.Tests;

public class ArchiveTest
{
public class ArchiveTest
[Fact]
public void BuildCorrectNextDocumentsUri()
{
[Fact]
public void BuildCorrectNextDocumentsUri()
var archive = new Archive(new Sender(1010))
{
var archive = new Archive(new Sender(1010))
Links = new Dictionary<string, Link>
{
Links = new Dictionary<string, Link>
["NEXT_DOCUMENTS"] = new Link("https://www.testing.no/1010/archive/1000/document?limit=100&offset=0")
{
["NEXT_DOCUMENTS"] = new Link("https://www.testing.no/1010/archive/1000/document?limit=100&offset=0")
{
Rel = "https://www.testing.no/relation/next_document"
}
Rel = "https://www.testing.no/relation/next_document"
}
};
}
};

Assert.True(archive.HasMoreDocuments());
Assert.Equal("https://www.testing.no/1010/archive/1000/document?limit=100&offset=0", archive.GetNextDocumentsUri().ToString());
Assert.True(archive.HasMoreDocuments());
Assert.Equal("https://www.testing.no/1010/archive/1000/document?limit=100&offset=0", archive.GetNextDocumentsUri().ToString());

var searchBy = new Dictionary<string, string>
{
["key"] = "val"
};
Assert.Equal("https://www.testing.no/1010/archive/1000/document?limit=100&offset=0&attributes=a2V5LHZhbA==", archive.GetNextDocumentsUri(searchBy).ToString());
}
var searchBy = new Dictionary<string, string>
{
["key"] = "val"
};
Assert.Equal("https://www.testing.no/1010/archive/1000/document?limit=100&offset=0&attributes=a2V5LHZhbA==", archive.GetNextDocumentsUri(searchBy).ToString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,68 @@
using V8;
using Xunit;

namespace Digipost.Api.Client.Archive.Tests
namespace Digipost.Api.Client.Archive.Tests;

public class DataTransferObjectConverterTests
{
public class DataTransferObjectConverterTests
public class FromDataTransferObject : DataTransferObjectConverterTests
{
public class FromDataTransferObject : DataTransferObjectConverterTests
{
private const string BaseUri = "https://contenturi.no";
const string BaseUri = "https://contenturi.no";

[Fact]
public void Archive()
[Fact]
public void Archive()
{
var source = new V8.Archive()
{
var source = new V8.Archive()
{
Name = "per",
Sender_Id = 1010,
};
Name = "per",
Sender_Id = 1010,
};

var expected = new Archive(new Sender(1010), "per");
var expected = new Archive(new Sender(1010), "per");

var actual = source.FromDataTransferObject();
var actual = source.FromDataTransferObject();

Comparator.AssertEqual(expected, actual);
}
Comparator.AssertEqual(expected, actual);
}

[Fact]
public void ArchiveDocumentBasicState()
[Fact]
public void ArchiveDocumentBasicState()
{
var newGuid = Guid.NewGuid();
var source = new Archive_Document()
{
var newGuid = Guid.NewGuid();
var source = new Archive_Document()
{
Uuid = newGuid.ToString(),
File_Name = "per.txt",
File_Type = "txt",
Content_Type = "text/plain",
Attributes = { },
Link = {new Link() {Rel = $"{BaseUri}/relations/get_something", Uri = $"{BaseUri}/something", Media_Type = "text/plain"}}
};
Uuid = newGuid.ToString(),
File_Name = "per.txt",
File_Type = "txt",
Content_Type = "text/plain",
Attributes = { },
Link = { new Link() { Rel = $"{BaseUri}/relations/get_something", Uri = $"{BaseUri}/something", Media_Type = "text/plain" } }
};

var expected = new ArchiveDocument(newGuid, "per.txt", "txt", "text/plain");
expected.Links.Add("get_something", new Common.Entrypoint.Link($"{BaseUri}/something") {MediaType = "text/plain", Rel = $"{BaseUri}/relations/get_something"});
var expected = new ArchiveDocument(newGuid, "per.txt", "txt", "text/plain");
expected.Links.Add("get_something", new Common.Entrypoint.Link($"{BaseUri}/something") { MediaType = "text/plain", Rel = $"{BaseUri}/relations/get_something" });

var actual = source.FromDataTransferObject();
var actual = source.FromDataTransferObject();

Comparator.AssertEqual(expected, actual);
}
Comparator.AssertEqual(expected, actual);
}

[Fact]
public void ArchiveDocumentToDto()
{
var newGuid = Guid.NewGuid();
var source = new ArchiveDocument(newGuid, "per.txt", "txt", "text/plain").WithAttribute("test", "val");
[Fact]
public void ArchiveDocumentToDto()
{
var newGuid = Guid.NewGuid();
var source = new ArchiveDocument(newGuid, "per.txt", "txt", "text/plain").WithAttribute("test", "val");

var expected = new Archive_Document()
{
Uuid = newGuid.ToString(),
File_Name = "per.txt",
File_Type = "txt",
Content_Type = "text/plain",
Attributes = { new Archive_Document_Attribute(){Key = "test", Value = "val"} },
};
var expected = new Archive_Document()
{
Uuid = newGuid.ToString(),
File_Name = "per.txt",
File_Type = "txt",
Content_Type = "text/plain",
Attributes = { new Archive_Document_Attribute() { Key = "test", Value = "val" } },
};

Comparator.AssertEqual(expected, source.ToDataTransferObject());
}
Comparator.AssertEqual(expected, source.ToDataTransferObject());
}
}
}
}
Loading

0 comments on commit b2fb26c

Please sign in to comment.