Skip to content

Commit

Permalink
Update .NET dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
markm77 committed Sep 18, 2023
1 parent cd2e451 commit aaa7f45
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1"/>
<PackageReference Include="Azure.Core" Version="1.34.0"/>
<PackageReference Include="Azure.Core" Version="1.35.0"/>
<PackageReference Include="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20210604.3" PrivateAssets="All"/>
<PackageReference Include="FluentValidation" Version="11.7.1"/>
<PackageReference Include="jose-jwt" Version="4.1.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amazon.Extensions.Configuration.SystemsManager" Version="5.1.0"/>
<PackageReference Include="Amazon.Extensions.Configuration.SystemsManager" Version="5.1.1"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1"/>
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0"/>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.10"/>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.11"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1"/>
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0"/>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0"/>
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.6.0-rc.1"/>
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.6.0-rc.1"/>
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.6.0-rc.1"/>
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.6.0"/>
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.6.0"/>
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.6.0"/>
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.5.1-beta.1"/>
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.7"/>
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.5.1-beta.1"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
<PackageReference Include="EFCore.NamingConventions" Version="7.0.2"/>
<PackageReference Include="FluentValidation" Version="11.7.1"/>
<PackageReference Include="jose-jwt" Version="4.1.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.10"/>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.32.2"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.11"/>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.0.0"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4"/>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<UserSecretsId>aa921213-9461-4f9e-8fec-153624ec67ad</UserSecretsId>
<AssemblyName>FinnovationLabs.OpenBanking.WebApp.Connector</AssemblyName>
<RootNamespace>FinnovationLabs.OpenBanking.WebApp.Connector</RootNamespace>
<Version>6.3.0</Version>
<Version>6.3.1</Version>
<Copyright>Finnovation Labs Limited and Contributors</Copyright>
<Company>Finnovation Labs Limited</Company>
<IsPackable>false</IsPackable>
Expand All @@ -16,8 +16,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.10"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.10">
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.11"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.3.0"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.10"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.11"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2"/>
<PackageReference Include="Microsoft.Playwright" Version="1.37.1"/>
<PackageReference Include="NSubstitute" Version="5.0.0"/>
<PackageReference Include="NSubstitute" Version="5.1.0"/>
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0"/>
<PackageReference Include="TestStack.BDDfy.Xunit" Version="1.2.0"/>
<PackageReference Include="xunit" Version="2.5.0"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="xunit" Version="2.5.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.7"/>
<PackageReference Include="BenchmarkDotNet" Version="0.13.8"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
<PackageReference Include="FsCheck.Xunit" Version="2.16.6"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1"/>
<PackageReference Include="NSubstitute" Version="5.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2"/>
<PackageReference Include="NSubstitute" Version="5.1.0"/>
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0"/>
<PackageReference Include="TestStack.BDDfy.Xunit" Version="1.2.0"/>
<PackageReference Include="xunit" Version="2.4.2"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="xunit" Version="2.5.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public class FileCertificateReaderTests
// }

[Fact]
public void GetCertificateAsync_FileNotFound_CertificateNotReturned()
public async Task GetCertificateAsync_FileNotFound_CertificateNotReturned()
{
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;

string fileName = Guid.NewGuid() + ".pfx";

X509Certificate2? certificate = new FileCertificateReader(path).GetCertificateAsync(fileName).Result;
X509Certificate2? certificate = await new FileCertificateReader(path).GetCertificateAsync(fileName);

certificate.Should().BeNull();
}
Expand Down
71 changes: 29 additions & 42 deletions test/OpenBanking.Library.Connector.UnitTests/Http/ApiClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public async Task ApiClient_RequestJsonAsync_Success(string url)

[Theory]
[InlineData("https://a5b2a8a9-1220-4aa4-aa83-0036a7bd1e69.com/stuff")]
public void ApiClient_RequestJsonAsync_Failure_NoContent(string url)
public async Task ApiClient_RequestJsonAsync_Failure_NoContent(string url)
{
HttpRequestMessage req = new HttpRequestBuilder()
.SetMethod(HttpMethod.Get)
Expand All @@ -134,27 +134,22 @@ public void ApiClient_RequestJsonAsync_Failure_NoContent(string url)
var mockHttp = new MockHttpMessageHandler();
mockHttp.When(HttpMethod.Get, url).Respond(r => new HttpResponseMessage(HttpStatusCode.OK));

using (var http = mockHttp.ToHttpClient())
{
var api = new ApiClient(
Substitute.For<IInstrumentationClient>(),
http);
using var http = mockHttp.ToHttpClient();
var api = new ApiClient(
Substitute.For<IInstrumentationClient>(),
http);

Action a = () =>
{
SerialisedEntity _ = api.SendExpectingJsonResponseAsync<SerialisedEntity>(
req,
null)
.Result;
};
Func<Task> a = async () =>
await api.SendExpectingJsonResponseAsync<SerialisedEntity>(
req,
null);

a.Should().Throw<HttpRequestException>();
}
await a.Should().ThrowAsync<HttpRequestException>();
}

[Theory]
[InlineData("https://a5b2a8a9-1220-4aa4-aa83-0036a7bd1e69.com/stuff")]
public void ApiClient_RequestJsonAsync_Failure(string url)
public async Task ApiClient_RequestJsonAsync_Failure(string url)
{
HttpRequestMessage req = new HttpRequestBuilder()
.SetMethod(HttpMethod.Get)
Expand All @@ -174,27 +169,23 @@ public void ApiClient_RequestJsonAsync_Failure(string url)
"application/json")
});

using (var http = mockHttp.ToHttpClient())
{
var api = new ApiClient(
Substitute.For<IInstrumentationClient>(),
http);
using var http = mockHttp.ToHttpClient();
var api = new ApiClient(
Substitute.For<IInstrumentationClient>(),
http);

Action a = () =>
{
SerialisedEntity _ = api.SendExpectingJsonResponseAsync<SerialisedEntity>(
req,
null).Result;
};
Func<Task> a = async () =>
await api.SendExpectingJsonResponseAsync<SerialisedEntity>(
req,
null);

a.Should().Throw<ExternalApiHttpErrorException>();
}
await a.Should().ThrowAsync<ExternalApiHttpErrorException>();
}


[Theory]
[InlineData("https://a5b2a8a9-1220-4aa4-aa83-0036a7bd1e69.com/stuff")]
public void ApiClient_RequestJsonAsync_Failure_StartEndTraceLogged(string url)
public async Task ApiClient_RequestJsonAsync_Failure_StartEndTraceLogged(string url)
{
HttpRequestMessage req = new HttpRequestBuilder()
.SetMethod(HttpMethod.Get)
Expand All @@ -215,20 +206,16 @@ public void ApiClient_RequestJsonAsync_Failure_StartEndTraceLogged(string url)
"application/json")
});

using (var http = mockHttp.ToHttpClient())
{
var api = new ApiClient(instrumentationClient, http);
using var http = mockHttp.ToHttpClient();
var api = new ApiClient(instrumentationClient, http);

Action a = () =>
{
SerialisedEntity _ = api.SendExpectingJsonResponseAsync<SerialisedEntity>(
req,
null).Result;
};
Func<Task> a = async () =>
await api.SendExpectingJsonResponseAsync<SerialisedEntity>(
req,
null);

a.Should().Throw<ExternalApiHttpErrorException>();
instrumentationClient.Received(1).Trace(Arg.Any<string>());
}
await a.Should().ThrowAsync<ExternalApiHttpErrorException>();
instrumentationClient.Received(1).Trace(Arg.Any<string>());
}

public class SerialisedEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
<PackageReference Include="FsCheck.Xunit" Version="2.16.6"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1"/>
<PackageReference Include="NSubstitute" Version="5.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2"/>
<PackageReference Include="NSubstitute" Version="5.1.0"/>
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0"/>
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0"/>
<PackageReference Include="xunit" Version="2.4.2"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="xunit" Version="2.5.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ public void Ctor_NonNullFacade_NoExceptionThrown()


[Fact]
public void GetCertificateAsync_EmptyThumbprint_NullReturned()
public async Task GetCertificateAsync_EmptyThumbprint_NullReturned()
{
var thumbprint = "";

var ioFacade = Substitute.For<IIoFacade>();

var rdr = new FileCertificateReader(ioFacade);
X509Certificate2? result = rdr.GetCertificateAsync(thumbprint).Result;
X509Certificate2? result = await rdr.GetCertificateAsync(thumbprint);

result.Should().BeNull();
ioFacade.DidNotReceive().GetContentPath();
ioFacade.DidNotReceive().GetDirectoryFiles(Arg.Any<string>(), Arg.Any<string>());
}

[Fact]
public void GetCertificateAsync_NoFiles_NullReturned()
public async Task GetCertificateAsync_NoFiles_NullReturned()
{
var files = new string[0];
var contentPath = "";
Expand All @@ -58,7 +58,7 @@ public void GetCertificateAsync_NoFiles_NullReturned()


var rdr = new FileCertificateReader(ioFacade);
X509Certificate2? result = rdr.GetCertificateAsync(thumbprint).Result;
X509Certificate2? result = await rdr.GetCertificateAsync(thumbprint);

result.Should().BeNull();
ioFacade.Received().GetContentPath();
Expand All @@ -67,7 +67,7 @@ public void GetCertificateAsync_NoFiles_NullReturned()


[Fact]
public void GetCertificateAsync_DirectoryNamespaceQueried()
public async Task GetCertificateAsync_DirectoryNamespaceQueried()
{
string[] files = { "file.cert" };
var contentPath = "";
Expand All @@ -83,7 +83,7 @@ public void GetCertificateAsync_DirectoryNamespaceQueried()

try
{
X509Certificate2? _ = rdr.GetCertificateAsync(thumbprint).Result;
X509Certificate2? _ = await rdr.GetCertificateAsync(thumbprint);

throw new InvalidOperationException("Test failed");
}
Expand Down

0 comments on commit aaa7f45

Please sign in to comment.