Skip to content

Commit 9688d21

Browse files
committed
trying to figure out why tests frezees in VSTS
1 parent ecb930d commit 9688d21

File tree

10 files changed

+1098
-9
lines changed

10 files changed

+1098
-9
lines changed

src/Server/Coderr.Server.SqlServer.Tests/Analysis/IncidentBeingAnalyzedMapper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
using codeRR.Server.ReportAnalyzer.Domain.Reports;
66
using codeRR.Server.SqlServer.Analysis;
77
using Xunit;
8+
using Xunit.Abstractions;
89

910
namespace codeRR.Server.SqlServer.Tests.Analysis
1011
{
1112
public class IncidentBeingAnalyzedMapperTests : IntegrationTest
1213
{
13-
public IncidentBeingAnalyzedMapperTests()
14+
public IncidentBeingAnalyzedMapperTests(ITestOutputHelper helper) : base(helper)
1415
{
1516
ResetDatabase();
1617
}

src/Server/Coderr.Server.SqlServer.Tests/Core/ApiKeys/Commands/CreateApiKeyHandlerTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Griffin.Data;
1212
using NSubstitute;
1313
using Xunit;
14+
using Xunit.Abstractions;
1415

1516
namespace codeRR.Server.SqlServer.Tests.Core.ApiKeys.Commands
1617
{
@@ -19,7 +20,7 @@ public class CreateApiKeyHandlerTests : IntegrationTest
1920
{
2021
private int _applicationId;
2122

22-
public CreateApiKeyHandlerTests()
23+
public CreateApiKeyHandlerTests(ITestOutputHelper helper) : base(helper)
2324
{
2425
GetApplicationId();
2526
}

src/Server/Coderr.Server.SqlServer.Tests/Core/ApiKeys/Commands/DeleteApiKeyHandlerTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Griffin.Data;
1212
using NSubstitute;
1313
using Xunit;
14+
using Xunit.Abstractions;
1415

1516
namespace codeRR.Server.SqlServer.Tests.Core.ApiKeys.Commands
1617
{
@@ -20,7 +21,7 @@ public class DeleteApiKeyHandlerTests : IntegrationTest
2021
private int _applicationId;
2122
private readonly ApiKey _existingEntity;
2223

23-
public DeleteApiKeyHandlerTests()
24+
public DeleteApiKeyHandlerTests(ITestOutputHelper helper) : base(helper)
2425
{
2526
GetApplicationId();
2627

src/Server/Coderr.Server.SqlServer.Tests/Core/ApiKeys/Queries/GetApiKeyHandlerTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using NSubstitute;
1212
using NSubstitute.Core;
1313
using Xunit;
14+
using Xunit.Abstractions;
1415

1516
namespace codeRR.Server.SqlServer.Tests.Core.ApiKeys.Queries
1617
{
@@ -20,7 +21,7 @@ public class GetApiKeyHandlerTests : IntegrationTest
2021
private Application _application;
2122
private readonly ApiKey _existingEntity;
2223

23-
public GetApiKeyHandlerTests()
24+
public GetApiKeyHandlerTests(ITestOutputHelper helper):base(helper)
2425
{
2526
GetApplication();
2627

src/Server/Coderr.Server.SqlServer.Tests/Core/ApiKeys/Queries/ListApiKeysHandlerTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Griffin.Data.Mapper;
99
using NSubstitute;
1010
using Xunit;
11+
using Xunit.Abstractions;
1112

1213
namespace codeRR.Server.SqlServer.Tests.Core.ApiKeys.Queries
1314
{
@@ -16,7 +17,7 @@ public class ListApiKeysHandlerTests : IntegrationTest
1617
{
1718
private readonly ApiKey _existingEntity;
1819

19-
public ListApiKeysHandlerTests()
20+
public ListApiKeysHandlerTests(ITestOutputHelper helper) : base(helper)
2021
{
2122
_existingEntity = new ApiKey
2223
{

src/Server/Coderr.Server.SqlServer.Tests/IntegrationTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
using codeRR.Server.SqlServer.Tests.Helpers;
44
using Griffin.Data;
55
using Griffin.Data.Mapper;
6+
using Xunit.Abstractions;
67

78
namespace codeRR.Server.SqlServer.Tests
89
{
10+
[Log]
911
public class IntegrationTest : IDisposable
1012
{
1113
private static DatabaseManager _databaseManager;
@@ -33,9 +35,9 @@ static IntegrationTest()
3335
mapper.Scan(typeof(AccountRepository).Assembly);
3436
EntityMappingProvider.Provider = mapper;
3537
}
36-
37-
public IntegrationTest()
38+
public IntegrationTest(ITestOutputHelper output)
3839
{
40+
LogAttribute.Logger = output;
3941
_testDataManager = new TestDataManager(_databaseManager.OpenConnection);
4042
}
4143

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using Xunit.Abstractions;
9+
using Xunit.Sdk;
10+
11+
namespace codeRR.Server.SqlServer.Tests
12+
{
13+
public class LogAttribute : BeforeAfterTestAttribute
14+
{
15+
public static ITestOutputHelper Logger { get; set; }
16+
17+
public override void Before(MethodInfo methodUnderTest)
18+
{
19+
Logger?.WriteLine("Running " + methodUnderTest.DeclaringType.Name + "." + methodUnderTest.Name);
20+
Debug.WriteLine("Running " + methodUnderTest.DeclaringType.Name + "." + methodUnderTest.Name);
21+
Console.WriteLine("Running " + methodUnderTest.DeclaringType.Name + "." + methodUnderTest.Name);
22+
base.Before(methodUnderTest);
23+
}
24+
25+
public override void After(MethodInfo methodUnderTest)
26+
{
27+
Logger?.WriteLine("Completed " + methodUnderTest.DeclaringType.Name + "." + methodUnderTest.Name);
28+
Debug.WriteLine("Completed " + methodUnderTest.DeclaringType.Name + "." + methodUnderTest.Name);
29+
Console.WriteLine("Completed " + methodUnderTest.DeclaringType.Name + "." + methodUnderTest.Name);
30+
base.After(methodUnderTest);
31+
}
32+
}
33+
}

src/Server/Coderr.Server.SqlServer.Tests/Modules/Geolocation/ErrorOriginRepositoryTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using codeRR.Server.App.Modules.Geolocation;
44
using codeRR.Server.SqlServer.Modules.Geolocation;
55
using Xunit;
6+
using Xunit.Abstractions;
67

78
namespace codeRR.Server.SqlServer.Tests.Modules.Geolocation
89
{
@@ -11,7 +12,7 @@ public class ErrorOriginRepositoryTests : IntegrationTest
1112
private int _reportId;
1213
private int _incidentId;
1314

14-
public ErrorOriginRepositoryTests()
15+
public ErrorOriginRepositoryTests(ITestOutputHelper helper) : base(helper)
1516
{
1617
ResetDatabase();
1718
CreateReportAndIncident(out _reportId, out _incidentId);

src/Server/Coderr.Server.SqlServer.Tests/app.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<configuration>
44
<connectionStrings>
5-
<add name="Db" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;Initial Catalog={databaseName};Integrated Security=True" providerName="System.Data.SqlClient" />
5+
<add name="Db" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;Initial Catalog={databaseName};Integrated Security=True;Connection Timeout=5" providerName="System.Data.SqlClient" />
66
</connectionStrings>
77
<runtime>
88
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

0 commit comments

Comments
 (0)