Skip to content

Commit

Permalink
Putting tests of nunit.common into a separate test assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
CharliePoole committed Jan 22, 2025
1 parent 9abfb9e commit 0db9a60
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 3 deletions.
7 changes: 7 additions & 0 deletions NUnitConsole.sln
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NUnit3.10", "src\TestData\N
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.common", "src\NUnitEngine\nunit.common\nunit.common.csproj", "{542685E5-8C2E-4425-ADD1-C45B55AFB964}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.common.tests", "src\NUnitEngine\nunit.common.tests\nunit.common.tests.csproj", "{F546CFE1-74B0-45D3-A06A-8972D73F4419}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -273,6 +275,10 @@ Global
{542685E5-8C2E-4425-ADD1-C45B55AFB964}.Debug|Any CPU.Build.0 = Debug|Any CPU
{542685E5-8C2E-4425-ADD1-C45B55AFB964}.Release|Any CPU.ActiveCfg = Release|Any CPU
{542685E5-8C2E-4425-ADD1-C45B55AFB964}.Release|Any CPU.Build.0 = Release|Any CPU
{F546CFE1-74B0-45D3-A06A-8972D73F4419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F546CFE1-74B0-45D3-A06A-8972D73F4419}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F546CFE1-74B0-45D3-A06A-8972D73F4419}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F546CFE1-74B0-45D3-A06A-8972D73F4419}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -318,6 +324,7 @@ Global
{8AFBB856-700A-4CCC-AE0E-9B622178E1E0} = {D31607D2-D689-488B-9F9F-92F47AC1D7F6}
{0555B97D-E918-455B-951C-74EFCDA8790A} = {D31607D2-D689-488B-9F9F-92F47AC1D7F6}
{542685E5-8C2E-4425-ADD1-C45B55AFB964} = {31B45C4C-206F-4F31-9CC6-33BF11DFEE39}
{F546CFE1-74B0-45D3-A06A-8972D73F4419} = {31B45C4C-206F-4F31-9CC6-33BF11DFEE39}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D8E4FC26-5422-4C51-8BBC-D1AC0A578711}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.IO;
using NUnit.Framework;

namespace NUnit.Engine.Internal.Logging
namespace NUnit.Engine
{
public class LoggingTests
{
Expand Down
19 changes: 19 additions & 0 deletions src/NUnitEngine/nunit.common.tests/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt

using System.Reflection;
using NUnitLite;

namespace NUnit.Engine.Tests
{
class Program
{
static int Main(string[] args)
{
#if NETFRAMEWORK
return new TextRunner(typeof(Program).Assembly).Execute(args);
#else
return new TextRunner(typeof(Program).GetTypeInfo().Assembly).Execute(args);
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void SingleElement()

Assert.That(node.Name, Is.EqualTo("myelement"));
Assert.That(node.Attributes, Is.Not.Null);
Assert.That(node.Attributes.Count, Is.EqualTo(0));
Assert.That(node.Attributes!.Count, Is.EqualTo(0));
Assert.That(node.ChildNodes.Count, Is.EqualTo(0));
}

Expand All @@ -30,7 +30,7 @@ public void SingleElementWithAttributes()

Assert.That(node.Name, Is.EqualTo("person"));
Assert.That(node.Attributes, Is.Not.Null);
Assert.That(node.Attributes.Count, Is.EqualTo(3));
Assert.That(node.Attributes!.Count, Is.EqualTo(3));
Assert.That(node.ChildNodes.Count, Is.EqualTo(0));
Assert.That(node.Attributes["name"]?.Value, Is.EqualTo("Fred"));
Assert.That(node.Attributes["age"]?.Value, Is.EqualTo("42"));
Expand Down
27 changes: 27 additions & 0 deletions src/NUnitEngine/nunit.common.tests/nunit.common.tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>NUnit</RootNamespace>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<NoWarn>$(NoWarn);618</NoWarn>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\nunit.snk</AssemblyOriginatorKeyFile>
<OutputPath>..\..\..\bin\$(Configuration)\</OutputPath>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)/../../Nullable.props" />

<ItemGroup>
<ProjectReference Include="..\nunit.common\nunit.common.csproj" />
<ProjectReference Include="..\nunit.engine.api\nunit.engine.api.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnitLite" Version="4.2.2" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,8 @@
<None Include="App.config" />
</ItemGroup>

<ItemGroup>
<Folder Include="Internal\Logging\" />
</ItemGroup>

</Project>

0 comments on commit 0db9a60

Please sign in to comment.