Skip to content

Commit 582dcc8

Browse files
committed
IntegrationTestFactory.GetEssConnection(): Clone connection settings rather than passing back a reference to the static collection.
1 parent 7d5d080 commit 582dcc8

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

src/EssSharp.Integration/Setup/IntegrationTestFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ internal static IntegrationTestSettingsConnection GetEssConnection( EssServerRol
203203
if ( Connections?.FirstOrDefault(conn => conn?.Role == role) is not IntegrationTestSettingsConnection connection )
204204
throw new Exception($@"A connection with the {role} role is not available");
205205

206-
return connection;
206+
return connection.Clone() as IntegrationTestSettingsConnection;
207207
}
208208

209209
/// <summary />

src/EssSharp.Integration/Setup/IntegrationTestSettings.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace EssSharp.Integration.Setup
1+
using System;
2+
3+
namespace EssSharp.Integration.Setup
24
{
35
/// <summary />
46
public class IntegrationTestSettings
@@ -11,25 +13,39 @@ public class IntegrationTestSettings
1113
}
1214

1315
/// <summary />
14-
public class IntegrationTestSettingsConnection
16+
public class IntegrationTestSettingsConnection : ICloneable
1517
{
1618
/// <summary />
1719
public string Server { get; set; }
20+
1821
/// <summary />
1922
public string Username { get; set; }
23+
2024
/// <summary />
2125
public string Password { get; set; }
26+
2227
/// <summary />
2328
public EssServerRole Role { get; set; }
29+
30+
/// <inheritdoc />
31+
public object Clone() => new IntegrationTestSettingsConnection()
32+
{
33+
Server = this.Server,
34+
Username = this.Username,
35+
Password = this.Password,
36+
Role = this.Role
37+
};
2438
}
2539

2640
/// <summary />
2741
public enum Role
2842
{
2943
/// <summary />
3044
ServiceAdministrator,
45+
3146
/// <summary />
3247
PowerUser,
48+
3349
/// <summary />
3450
User
3551
}

0 commit comments

Comments
 (0)