Skip to content

Commit

Permalink
chore: update nuget packages test dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
vicfergar committed Jul 9, 2023
1 parent 79acb70 commit f408f02
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/HassClient.Core.Tests/HassClient.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
</ItemGroup>

<ItemGroup>
Expand Down
16 changes: 8 additions & 8 deletions src/HassClient.WS.Tests/EnvironmentSetup.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using DotNet.Testcontainers.Builders;
using DotNet.Testcontainers.Containers;
using NUnit.Framework;
using HassClient.WS.Tests.Extensions;
using NUnit.Framework;
using System;
using System.IO;
using System.Linq;
Expand All @@ -12,24 +12,24 @@ namespace HassClient.WS.Tests
[SetUpFixture]
public class EnvironmentSetup
{
private TestcontainersContainer hassContainer;
private IContainer hassContainer;

[OneTimeSetUp]
public async Task GlobalSetupAsync()
{
var instanceBaseUrl = Environment.GetEnvironmentVariable(BaseHassWSApiTest.TestsInstanceBaseUrlVar);
string instanceBaseUrl = Environment.GetEnvironmentVariable(BaseHassWSApiTest.TestsInstanceBaseUrlVar);

if (instanceBaseUrl == null)
{
// Create temporary directory with tests resources
var tmpDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
string tmpDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(tmpDirectory);
DirectoryExtensions.CopyFilesRecursively("./resources", tmpDirectory);

const int HassPort = 8123;
const string HassVersion = "latest";
const string tokenFilename = "TOKEN";
var testcontainersBuilder = new TestcontainersBuilder<TestcontainersContainer>()
ContainerBuilder testcontainersBuilder = new ContainerBuilder()
.WithImage($"homeassistant/home-assistant:{HassVersion}")
.WithPortBinding(HassPort, assignRandomHostPort: true)
.WithExposedPort(HassPort)
Expand All @@ -43,9 +43,9 @@ public async Task GlobalSetupAsync()
this.hassContainer = testcontainersBuilder.Build();
await this.hassContainer.StartAsync();

var mappedPort = this.hassContainer.GetMappedPublicPort(HassPort);
var hostTokenPath = Path.Combine(tmpDirectory, "scripts", tokenFilename);
var accessToken = File.ReadLines(hostTokenPath).First();
ushort mappedPort = this.hassContainer.GetMappedPublicPort(HassPort);
string hostTokenPath = Path.Combine(tmpDirectory, "scripts", tokenFilename);
string accessToken = File.ReadLines(hostTokenPath).First();

Environment.SetEnvironmentVariable(BaseHassWSApiTest.TestsInstanceBaseUrlVar, $"http://localhost:{mappedPort}");
Environment.SetEnvironmentVariable(BaseHassWSApiTest.TestsAccessTokenVar, accessToken);
Expand Down
10 changes: 5 additions & 5 deletions src/HassClient.WS.Tests/HassClient.WS.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.1" />
<PackageReference Include="DotNet.Testcontainers" Version="1.6.0-beta.2104" />
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="Ninja.WebSockets" Version="1.1.8" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Testcontainers" Version="3.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit f408f02

Please sign in to comment.