Skip to content

Commit

Permalink
apply TestLifeAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryjiang committed Jan 16, 2025
1 parent 567e30f commit ab4e1b6
Show file tree
Hide file tree
Showing 27 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1" />
<PackageVersion Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="xunit" Version="2.4.0" />
<PackageVersion Include="xunit.v3" Version="1.0.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.5" />
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/AspNetIntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/AutofacTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
using SuperSocket.Server;
using System.Threading;
using SuperSocket.Tests.Command;
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/BeginEndMarkProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using SuperSocket.Server.Abstractions.Host;
using SuperSocket.Server.Host;
using Xunit;
using Xunit.Abstractions;

namespace SuperSocket.Tests
{
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/ClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using SuperSocket.Command;
using SuperSocket.ProtoBase;
using Xunit;
using Xunit.Abstractions;
using SuperSocket.Client;
using SuperSocket.Server.Host;
using SuperSocket.Tests.Command;
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/CommandTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
using System.Threading;
using SuperSocket.Tests.Command;
using SuperSocket.Server;
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
using SuperSocket.Server;
using System.Threading;
using SuperSocket.Tests.Command;
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/FixedHeaderProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using SuperSocket.Server.Host;
using SuperSocket.Server.Abstractions;
using Xunit;
using Xunit.Abstractions;

namespace SuperSocket.Tests
{
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/FixedSizeProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using SuperSocket.Server.Host;
using SuperSocket.Server.Abstractions;
using Xunit;
using Xunit.Abstractions;

namespace SuperSocket.Tests
{
Expand Down
3 changes: 3 additions & 0 deletions test/SuperSocket.Tests/GlobalAssembly.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using SuperSocket.Tests;

[assembly:TestLife]
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/HttpPipelineFilterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Xunit;
using Xunit.Abstractions;
using SuperSocket.Client;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/MainTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Server.Host;
using Xunit;
using Xunit.Abstractions;

/// <summary>
/// Run selected test case by command
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/ObjectPipeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
using System.Threading;
using SuperSocket.Connection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
using System.Threading;

namespace SuperSocket.Tests
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/PerfTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using SuperSocket.Server;
using SuperSocket.Server.Host;
using Xunit;
using Xunit.Abstractions;

namespace SuperSocket.Tests
{
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/ProtocolTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using SuperSocket.Server;
using SuperSocket.Server.Abstractions;
using Xunit;
using Xunit.Abstractions;

namespace SuperSocket.Tests
{
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/ProxyProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using SuperSocket.Server.Host;
using SuperSocket.Server.Abstractions;
using Xunit;
using Xunit.Abstractions;
using System.Net;
using System.Linq;
using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/ServerOptionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
using System.Threading;

namespace SuperSocket.Tests
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/SessionContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using SuperSocket.ProtoBase;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
using System.Threading;
using SuperSocket.Connection;
using SuperSocket.Server;
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/SessionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Threading.Tasks;
using SuperSocket.ProtoBase;
using Xunit;
using Xunit.Abstractions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using SuperSocket;
Expand Down
2 changes: 1 addition & 1 deletion test/SuperSocket.Tests/SuperSocket.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.v3" />
<PackageReference Include="xunit.runner.visualstudio" />
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/SwitchProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Host;
using Xunit;
using Xunit.Abstractions;

namespace SuperSocket.Tests
{
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/TerminatorProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Host;
using Xunit;
using Xunit.Abstractions;

namespace SuperSocket.Tests
{
Expand Down
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/TestClassBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using SuperSocket.Server.Host;
using SuperSocket.Server.Abstractions.Host;
using Xunit;
using Xunit.Abstractions;

namespace SuperSocket.Tests
{
Expand Down
19 changes: 19 additions & 0 deletions test/SuperSocket.Tests/TestLifeAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Reflection;
using Xunit.v3;

namespace SuperSocket.Tests
{
public class TestLifeAttribute : BeforeAfterTestAttribute
{
public override void Before(MethodInfo methodUnderTest, IXunitTest test)
{
Console.WriteLine($"Start to test {test.TestDisplayName}...");
}

public override void After(MethodInfo methodUnderTest, IXunitTest test)
{
Console.WriteLine($"Finished the test {test.TestDisplayName}...");
}
}
}
1 change: 0 additions & 1 deletion test/SuperSocket.Tests/WebSocket/WebSocketBasicTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
using SuperSocket.Server.Abstractions.Host;
using SuperSocket.Tests.Command;
using Xunit;
using Xunit.Abstractions;
using SuperSocket.Server.Abstractions.Session;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Threading.Tasks;
using SuperSocket.ProtoBase;
using Xunit;
using Xunit.Abstractions;
using Microsoft.Extensions.Hosting;
using SuperSocket;
using SuperSocket.WebSocket.Server;
Expand Down

0 comments on commit ab4e1b6

Please sign in to comment.