Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add diff integration base classes for diff test frameworks #144

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
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@

<ItemGroup>
<PackageReference Include="Codit.Testing.Xslt.Helper" Version="3.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="MSTest" Version="3.4.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Arcus.Testing.Assert\Arcus.Testing.Assert.csproj" />
<ProjectReference Include="..\..\src\Arcus.Testing.Core\Arcus.Testing.Core.csproj" />
<ProjectReference Include="..\..\src\Arcus.Testing.Logging.MSTest\Arcus.Testing.Logging.MSTest.csproj" />
<ProjectReference Include="..\..\src\Arcus.Testing.Logging.Xunit\Arcus.Testing.Logging.Xunit.csproj" />
<ProjectReference Include="..\..\src\Arcus.Testing.Logging.NUnit\Arcus.Testing.Logging.NUnit.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Arcus.Testing.Sample.TestingFrameworkMigration
{
/// <summary>
/// Base template for providing common and much-needed functionality to integration tests for the MSTest testing framework.
/// </summary>
public abstract class MSTestIntegrationTest
{
/// <summary>
/// Initializes a new instance of the <see cref="MSTestIntegrationTest" /> class.
/// </summary>
protected MSTestIntegrationTest()
{
Config = TestConfig.Create();
ScenarioFiles = ResourceDirectory.CurrentDirectory.WithSubDirectory("ScenarioFiles");
}

/// <summary>
/// Gets the current configuration loaded for this integration test suite.
/// </summary>
protected TestConfig Config { get; }

/// <summary>
/// Gets the resource directory containing the scenario files for this integration test suite.
/// </summary>
protected ResourceDirectory ScenarioFiles { get; }

/// <summary>
/// Gets the logger to write diagnostic messages during the integration test execution.
/// </summary>
protected ILogger Logger => new MSTestLogger(TestContext);

/// <summary>
/// Gets the test context for the current test run.
/// </summary>
public TestContext TestContext { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Microsoft.Extensions.Logging;
using NUnit.Framework;

namespace Arcus.Testing.Sample.TestingFrameworkMigration
{
/// <summary>
/// Base template for providing common and much-needed functionality to integration tests in for the NUnit testing framework.
/// </summary>
public abstract class NUnitIntegrationTest
{
/// <summary>
/// Initializes a new instance of the <see cref="NUnitIntegrationTest" /> class.
/// </summary>
protected NUnitIntegrationTest()
{
Config = TestConfig.Create();
ScenarioFiles = ResourceDirectory.CurrentDirectory.WithSubDirectory("ScenarioFiles");
Logger = new NUnitTestLogger(TestContext.Out, TestContext.Error);
}

/// <summary>
/// Gets the current configuration loaded for this integration test suite.
/// </summary>
protected TestConfig Config { get; }

/// <summary>
/// Gets the resource directory containing the scenario files for this integration test suite.
/// </summary>
protected ResourceDirectory ScenarioFiles { get; }

/// <summary>
/// Gets the logger to write diagnostic messages during the integration test execution.
/// </summary>
protected ILogger Logger { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Arcus.Testing.Sample.TestingFrameworkMigration.OutputComparison
{
public class XsltTests : IntegrationTest
public class XsltTests : XunitIntegrationTest
{
public XsltTests(ITestOutputHelper outputWriter) : base(outputWriter)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
namespace Arcus.Testing.Sample.TestingFrameworkMigration
{
/// <summary>
/// Base template for providing common and much-needed functionality to integration tests.
/// Base template for providing common and much-needed functionality to integration tests for the xUnit testing framework.
/// </summary>
public abstract class IntegrationTest
public abstract class XunitIntegrationTest
{
/// <summary>
/// Initializes a new instance of the <see cref="IntegrationTest" /> class.
/// Initializes a new instance of the <see cref="XunitIntegrationTest" /> class.
/// </summary>
protected IntegrationTest(ITestOutputHelper outputWriter)
protected XunitIntegrationTest(ITestOutputHelper outputWriter)
{
Config = TestConfig.Create();
ScenarioFiles = ResourceDirectory.CurrentDirectory.WithSubDirectory("ScenarioFiles");
Expand Down
Loading