Skip to content

Commit

Permalink
Using the locker to ensure the execution of the integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
daxnet committed Nov 20, 2017
1 parent 2516bb4 commit 98f968e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class EntityFrameworkRepositoryTests : IClassFixture<PostgreSQLFixture>,

public EntityFrameworkRepositoryTests(PostgreSQLFixture fixture)
{
Monitor.Enter(PostgreSQLFixture.locker);

//Thread.Sleep(1000);
this.fixture = fixture;
}
Expand Down Expand Up @@ -265,6 +267,7 @@ public void Dispose()
{
this.fixture.ClearTables();
//Thread.Sleep(1000);
Monitor.Exit(PostgreSQLFixture.locker);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class EventSourcingDomainRepositoryTests : DisposableObject, IClassFixtur

public EventSourcingDomainRepositoryTests(PostgreSQLFixture fixture)
{
Monitor.Enter(PostgreSQLFixture.locker);
// Thread.Sleep(1000);
this.fixture = fixture;
}
Expand Down Expand Up @@ -165,6 +166,7 @@ protected override void Dispose(bool disposing)
this.fixture.ClearTables();
}
//Thread.Sleep(1000);
Monitor.Exit(PostgreSQLFixture.locker);
}
}
}
2 changes: 2 additions & 0 deletions tests/Apworks.Tests.Integration/Fixtures/PostgreSQLFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace Apworks.Tests.Integration.Fixtures
{
public class PostgreSQLFixture
{
public static readonly object locker = new object();

public const string ConnectionString = "User ID=test;Password=oe9jaacZLbR9pN;Host=localhost;Port=5432;Database=test;";

private const string CreateAddressTableSql = @"CREATE TABLE ""Addresses"" (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Apworks.Tests.Integration.Fixtures
{
public class SQLServerFixture
{
public static readonly object locker = new object();
public const string ConnectionString = "Server=localhost;Database=SQLServerEventStoreTest;User Id=sa;Password=G1veMeP@ss";
public const string ConnectionStringWithoutDatabase = "Server=localhost;User Id=sa;Password=G1veMeP@ss";

Expand Down
3 changes: 3 additions & 0 deletions tests/Apworks.Tests.Integration/PostgreSQLEventStoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Xunit;

namespace Apworks.Tests.Integration
Expand All @@ -19,12 +20,14 @@ public class PostgreSQLEventStoreTests : IClassFixture<PostgreSQLFixture>, IDisp

public PostgreSQLEventStoreTests(PostgreSQLFixture fixture)
{
Monitor.Enter(PostgreSQLFixture.locker);
this.fixture = fixture;
}

public void Dispose()
{
this.fixture.ClearTables();
Monitor.Exit(PostgreSQLFixture.locker);
}

[Fact]
Expand Down
3 changes: 3 additions & 0 deletions tests/Apworks.Tests.Integration/SQLServerEventStoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Xunit;

namespace Apworks.Tests.Integration
Expand All @@ -19,12 +20,14 @@ public class SQLServerEventStoreTests : IClassFixture<SQLServerFixture>, IDispos

public SQLServerEventStoreTests(SQLServerFixture fixture)
{
Monitor.Enter(SQLServerFixture.locker);
this.fixture = fixture;
}

public void Dispose()
{
this.fixture.ClearTables();
Monitor.Exit(SQLServerFixture.locker);
}

[Fact]
Expand Down

0 comments on commit 98f968e

Please sign in to comment.