Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .nuget/Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
Version 9.1.2
Version 9.1.3
Availability: .NET 9 and .NET 8

# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs

Version 9.1.2
Availability: .NET 9 and .NET 8

# ALM
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
Version 9.1.2
Version 9.1.3
Availability: .NET 9 and .NET 8

# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs

# Improvements
- CHANGED AspNetCoreHostTest class in the Codebelt.Extensions.Xunit.Hosting.AspNetCore namespace to include the IWebHostTest interface

Version 9.1.2
Availability: .NET 9 and .NET 8

# ALM
Expand Down
14 changes: 13 additions & 1 deletion .nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
Version 9.1.2
Version 9.1.3
Availability: .NET 9, .NET 8 and .NET Standard 2.0

# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs

# Bug Fixes
- FIXED IGenericHostTest interface in the Codebelt.Extensions.Xunit.Hosting namespace to include the IHostTest interface

# Improvements
- CHANGED HostTest class in the Codebelt.Extensions.Xunit.Hosting namespace to include IGenericHostTest interface

Version 9.1.2
Availability: .NET 9, .NET 8 and .NET Standard 2.0

# ALM
Expand Down
8 changes: 4 additions & 4 deletions .nuget/Codebelt.Extensions.Xunit.Hosting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ More documentation available at our documentation site:

### CSharp Example

Source: [AspNetCoreHostTestTest.cs](https://github.com/codebeltnet/xunit/tree/main/test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/AspNetCoreHostTestTest.cs)

```csharp
public class AspNetCoreHostTestTest : AspNetCoreHostTest<AspNetCoreHostFixture>
public class HostTestTest : HostTest<HostFixture>
{
private readonly IServiceProvider _provider;

public AspNetCoreHostTestTest(AspNetCoreHostFixture hostFixture, ITestOutputHelper output) : base(hostFixture, output)
public HostTestTest(HostFixture hostFixture, ITestOutputHelper output) : base(hostFixture, output)
{
_provider = hostFixture.ServiceProvider;
_provider.GetRequiredService<ITestOutputHelperAccessor>().TestOutput = output;
Expand All @@ -43,3 +41,5 @@ public class AspNetCoreHostTestTest : AspNetCoreHostTest<AspNetCoreHostFixture>
}
}
```

A similar but real life example can be found here: [AspNetCoreHostTestTest.cs](https://github.com/codebeltnet/xunit/tree/main/test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/AspNetCoreHostTestTest.cs)
8 changes: 7 additions & 1 deletion .nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
Version 9.1.2
Version 9.1.3
Availability: .NET 9 and .NET 8

# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs

Version 9.1.2
Availability: .NET 9, .NET 8 and .NET Standard 2.0

# ALM
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ For more details, please refer to `PackageReleaseNotes.txt` on a per assembly ba
> [!NOTE]
> Changelog entries prior to version 8.4.0 was migrated from previous versions of Cuemon.Extensions.Xunit, Cuemon.Extensions.Xunit.Hosting, and Cuemon.Extensions.Xunit.Hosting.AspNetCore.

## [9.1.3] - 2025-04-03

### Fixed

- IGenericHostTest interface in the Codebelt.Extensions.Xunit.Hosting namespace to include the IHostTest interface

### Changed

- HostTest class in the Codebelt.Extensions.Xunit.Hosting namespace to include the IGenericHostTest interface
- AspNetCoreHostTest class in the Codebelt.Extensions.Xunit.Hosting.AspNetCore namespace to include the IWebHostTest interface

## [9.1.2] - 2025-04-03

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Codebelt.Extensions.Xunit.Hosting.AspNetCore
/// <typeparam name="T">The type of the object that implements the <see cref="IAspNetCoreHostFixture"/> interface.</typeparam>
/// <seealso cref="Test" />
/// <seealso cref="HostTest{T}" />
public abstract class AspNetCoreHostTest<T> : HostTest<T> where T : class, IAspNetCoreHostFixture
public abstract class AspNetCoreHostTest<T> : HostTest<T>, IWebHostTest where T : class, IAspNetCoreHostFixture
{
/// <summary>
/// Initializes a new instance of the <see cref="AspNetCoreHostTest{T}"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/// </summary>
/// <seealso cref="IGenericHostTest"/>
/// <seealso cref="IPipelineTest" />
/// <seealso cref="IHostTest" />
public interface IWebHostTest : IGenericHostTest, IPipelineTest, IHostTest
public interface IWebHostTest : IGenericHostTest, IPipelineTest
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Codebelt.Extensions.Xunit.Hosting.AspNetCore
{
internal sealed class WebHostTest : AspNetCoreHostTest<IAspNetCoreHostFixture>, IWebHostTest
internal sealed class WebHostTest : AspNetCoreHostTest<IAspNetCoreHostFixture>
{
private readonly Action<IApplicationBuilder> _pipelineConfigurator;
private readonly Action<IServiceCollection> _serviceConfigurator;
Expand Down
2 changes: 1 addition & 1 deletion src/Codebelt.Extensions.Xunit.Hosting/GenericHostTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Codebelt.Extensions.Xunit.Hosting
{
internal sealed class GenericHostTest : HostTest<IHostFixture>, IGenericHostTest
internal sealed class GenericHostTest : HostTest<IHostFixture>
{
private readonly Action<IServiceCollection> _serviceConfigurator;
private readonly Action<HostBuilderContext, IServiceCollection> _serviceConfiguratorWithContext;
Expand Down
2 changes: 1 addition & 1 deletion src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// <seealso cref="Test" />
/// <seealso cref="IClassFixture{TFixture}" />
/// <remarks>The class needed to be designed in this rather complex way, as this is the only way that xUnit supports a shared context. The need for shared context is theoretical at best, but it does opt-in for Scoped instances.</remarks>
public abstract class HostTest<T> : Test, IClassFixture<T> where T : class, IHostFixture
public abstract class HostTest<T> : Test, IGenericHostTest, IClassFixture<T> where T : class, IHostFixture
{
/// <summary>
/// Initializes a new instance of the <see cref="HostTest{T}"/> class.
Expand Down Expand Up @@ -52,14 +52,14 @@
}
Host = hostFixture.Host;
ServiceProvider = hostFixture.Host.Services;
Configure(hostFixture.Configuration, hostFixture.HostingEnvironment);

Check warning on line 55 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Remove this call from a constructor to the overridable 'Configure' method. (https://rules.sonarsource.com/csharp/RSPEC-1699)

Check warning on line 55 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Remove this call from a constructor to the overridable 'Configure' method. (https://rules.sonarsource.com/csharp/RSPEC-1699)

Check warning on line 55 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Remove this call from a constructor to the overridable 'Configure' method. (https://rules.sonarsource.com/csharp/RSPEC-1699)

Check warning on line 55 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Remove this call from a constructor to the overridable 'Configure' method. (https://rules.sonarsource.com/csharp/RSPEC-1699)

Check warning on line 55 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Remove this call from a constructor to the overridable 'Configure' method. (https://rules.sonarsource.com/csharp/RSPEC-1699)
}

/// <summary>
/// Initializes the specified host fixture.
/// </summary>
/// <param name="hostFixture">The host fixture to initialize.</param>
[Obsolete("This method is obsolete and will be removed in a future version. It remains only to support binary compatibility.")]

Check warning on line 62 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 62 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 62 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 62 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 62 in src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs

View workflow job for this annotation

GitHub Actions / call-sonarcloud / 🔬 Code Quality Analysis

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)
protected virtual void InitializeHostFixture(T hostFixture)
{
}
Expand Down
3 changes: 2 additions & 1 deletion src/Codebelt.Extensions.Xunit.Hosting/IGenericHostTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace Codebelt.Extensions.Xunit.Hosting
/// <seealso cref="IConfigurationTest" />
/// <seealso cref="IHostingEnvironmentTest" />
/// <seealso cref="ITest" />
public interface IGenericHostTest : IServiceTest, IConfigurationTest, IHostingEnvironmentTest, ITest
/// <seealso cref="IHostTest"/>
public interface IGenericHostTest : IServiceTest, IConfigurationTest, IHostingEnvironmentTest, ITest, IHostTest
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ public void ShouldLogToXunitTestLogging()
Assert.Equal("Information: Hello from ShouldLogToXunitTestLogging", entry.Message);
}

[Fact]
public void Test_VerifyAbstractions()
{
using var hostTest = WebHostTestFactory.Create(hostFixture: null);
Assert.IsAssignableFrom<IWebHostTest>(hostTest);
Assert.IsAssignableFrom<IPipelineTest>(hostTest);
Assert.IsAssignableFrom<IGenericHostTest>(hostTest);
Assert.IsAssignableFrom<IServiceTest>(hostTest);
Assert.IsAssignableFrom<IConfigurationTest>(hostTest);
Assert.IsAssignableFrom<IHostingEnvironmentTest>(hostTest);
Assert.IsAssignableFrom<ITest>(hostTest);
Assert.IsAssignableFrom<IHostTest>(hostTest);
Assert.IsAssignableFrom<IDisposable>(hostTest);
Assert.IsAssignableFrom<IAsyncDisposable>(hostTest);
}

public override void ConfigureApplication(IApplicationBuilder app)
{
app.ApplicationServices.GetRequiredService<ILogger<AspNetCoreHostTestTest>>().LogInformation(nameof(ConfigureApplication));
Expand Down
14 changes: 14 additions & 0 deletions test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ public void Test_ShouldHaveEnvironmentOfDevelopment()
Assert.Equal("Development", HostingEnvironment.EnvironmentName);
}

[Fact]
public void Test_VerifyAbstractions()
{
using var hostTest = GenericHostTestFactory.Create(hostFixture: null);
Assert.IsAssignableFrom<IGenericHostTest>(hostTest);
Assert.IsAssignableFrom<IServiceTest>(hostTest);
Assert.IsAssignableFrom<IConfigurationTest>(hostTest);
Assert.IsAssignableFrom<IHostingEnvironmentTest>(hostTest);
Assert.IsAssignableFrom<ITest>(hostTest);
Assert.IsAssignableFrom<IHostTest>(hostTest);
Assert.IsAssignableFrom<IDisposable>(hostTest);
Assert.IsAssignableFrom<IAsyncDisposable>(hostTest);
}

protected override void OnDisposeManagedResources()
{
_scope?.Dispose();
Expand Down
Loading