Skip to content

Commit 19f834f

Browse files
committed
PR cleanup.
1 parent 138a347 commit 19f834f

File tree

5 files changed

+80
-39
lines changed

5 files changed

+80
-39
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Firebird ADO.NET Data provider for .NET and Mono
3+
*
4+
* The contents of this file are subject to the Initial
5+
* Developer's Public License Version 1.0 (the "License");
6+
* you may not use this file except in compliance with the
7+
* License. You may obtain a copy of the License at
8+
* http://www.firebirdsql.org/index.php?op=doc&id=idpl
9+
*
10+
* Software distributed under the License is distributed on
11+
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
12+
* express or implied. See the License for the specific
13+
* language governing rights and limitations under the License.
14+
*
15+
* Copyright (c) 2017 @realic, Jiri Cincura ([email protected])
16+
* All Rights Reserved.
17+
*/
18+
19+
using System;
20+
21+
namespace FirebirdSql.Data.Common
22+
{
23+
internal static class ConnectionPoolLifetimeHelper
24+
{
25+
internal static bool IsAlive(long connectionLifeTime, long created, long now)
26+
{
27+
if (connectionLifeTime == 0)
28+
return true;
29+
return (now - created) < (connectionLifeTime * 1000);
30+
}
31+
}
32+
}

Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnectionPoolManager.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,4 @@ void CheckDisposed()
260260
throw new ObjectDisposedException(nameof(FbConnectionPoolManager));
261261
}
262262
}
263-
264-
internal static class ConnectionPoolLifetimeHelper
265-
{
266-
internal static bool IsAlive(long connectionLifeTime, long created, long now)
267-
{
268-
if (connectionLifeTime == 0)
269-
return true;
270-
return (now - created) < (connectionLifeTime * 1000);
271-
}
272-
}
273263
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Firebird ADO.NET Data provider for .NET and Mono
3+
*
4+
* The contents of this file are subject to the Initial
5+
* Developer's Public License Version 1.0 (the "License");
6+
* you may not use this file except in compliance with the
7+
* License. You may obtain a copy of the License at
8+
* http://www.firebirdsql.org/index.php?op=doc&id=idpl
9+
*
10+
* Software distributed under the License is distributed on
11+
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
12+
* express or implied. See the License for the specific
13+
* language governing rights and limitations under the License.
14+
*
15+
* Copyright (c) 2017 @realic, Jiri Cincura ([email protected])
16+
* All Rights Reserved.
17+
*/
18+
19+
using System;
20+
using FirebirdSql.Data.Common;
21+
using FirebirdSql.Data.FirebirdClient;
22+
using NUnit.Framework;
23+
24+
namespace FirebirdSql.Data.UnitTests
25+
{
26+
[TestFixture]
27+
public class ConnectionPoolLifetimeHelperTests
28+
{
29+
[Test]
30+
public void IsAliveTrueIfLifetimeNotExceed()
31+
{
32+
var now = 1_000_000;
33+
var timeAgo = now - (10 * 1000);
34+
var isAlive = ConnectionPoolLifetimeHelper.IsAlive(20, timeAgo, now);
35+
Assert.IsTrue(isAlive);
36+
}
37+
38+
[Test]
39+
public void IsAliveFalseIfLifetimeIsExceed()
40+
{
41+
var now = 1_000_000;
42+
var timeAgo = now - (30 * 1000);
43+
var isAlive = ConnectionPoolLifetimeHelper.IsAlive(20, timeAgo, now);
44+
Assert.IsFalse(isAlive);
45+
}
46+
}
47+
}

Provider/src/FirebirdSql.Data.UnitTests/FbConnectionPoolManagerTest.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

Provider/src/FirebirdSql.Data.UnitTests/FirebirdSql.Data.UnitTests_NET45.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<Compile Include="FbBooleanSupportTests.cs" />
5858
<Compile Include="FbConnectionStringTests.cs" />
5959
<Compile Include="FbConnectionStringBuilderTests.cs" />
60-
<Compile Include="FbConnectionPoolManagerTest.cs" />
60+
<Compile Include="ConnectionPoolLifetimeHelperTests.cs" />
6161
<Compile Include="FbExceptionTests.cs" />
6262
<Compile Include="FbRemoteEventTests.cs" />
6363
<Compile Include="FbTestFixtureAttribute.cs" />

0 commit comments

Comments
 (0)