diff --git a/tests/Gigya.Microdot.UnitTests/Discovery/Rewrite/MultiEnvironmentServiceDiscoveryPreferredEnvironmentTests.cs b/tests/Gigya.Microdot.UnitTests/Discovery/Rewrite/MultiEnvironmentServiceDiscoveryPreferredEnvironmentTests.cs
index 5a16f4ad..62ba9d73 100644
--- a/tests/Gigya.Microdot.UnitTests/Discovery/Rewrite/MultiEnvironmentServiceDiscoveryPreferredEnvironmentTests.cs
+++ b/tests/Gigya.Microdot.UnitTests/Discovery/Rewrite/MultiEnvironmentServiceDiscoveryPreferredEnvironmentTests.cs
@@ -71,6 +71,8 @@ public async Task Setup()
public void TearDown()
{
_unitTestingKernel.Dispose();
+ _loadBalancerByEnvironment.Clear();
+ _serviceDiscovery = null;
}
[Test]
diff --git a/tests/Gigya.Microdot.UnitTests/Gigya.Microdot.UnitTests.csproj b/tests/Gigya.Microdot.UnitTests/Gigya.Microdot.UnitTests.csproj
index 034c4f19..de8733d8 100644
--- a/tests/Gigya.Microdot.UnitTests/Gigya.Microdot.UnitTests.csproj
+++ b/tests/Gigya.Microdot.UnitTests/Gigya.Microdot.UnitTests.csproj
@@ -94,6 +94,7 @@
+
diff --git a/tests/Gigya.Microdot.UnitTests/RequestOverridesTests.cs b/tests/Gigya.Microdot.UnitTests/RequestOverridesTests.cs
new file mode 100644
index 00000000..04838cd3
--- /dev/null
+++ b/tests/Gigya.Microdot.UnitTests/RequestOverridesTests.cs
@@ -0,0 +1,39 @@
+using System.Collections.Generic;
+using System.Linq;
+using Gigya.Microdot.SharedLogic.HttpService;
+using NUnit.Framework;
+
+namespace Gigya.Microdot.UnitTests
+{
+ [TestFixture()]
+ public class RequestOverridesTests
+ {
+ [Test]
+ public void CheckRequestOverridesShallowClone()
+ {
+ RequestOverrides ro = new RequestOverrides();
+ HostOverride ho1 = new HostOverride{Host = "testHost1", Port = 1234, ServiceName = "testService1"};
+ ho1.AdditionalProperties = new Dictionary();
+ ho1.AdditionalProperties.Add("ho1Key", "ho1Value");
+
+ HostOverride ho2 = new HostOverride{ Host = "testHost2", Port = 1235, ServiceName = "testService2"};
+ ho2.AdditionalProperties = new Dictionary();
+ ho2.AdditionalProperties.Add("ho2Key", "ho2Value");
+
+ ro.Hosts = new List(new []{ho1, ho2});
+ ro.PreferredEnvironment = "pe1";
+ ro.AdditionalProperties = new Dictionary();
+ ro.AdditionalProperties.Add("roKey", "roValue");
+
+ RequestOverrides roResult = ro.ShallowCloneWithDifferentPreferredEnvironment("pe2");
+
+ Assert.AreEqual(ro.Hosts.Count, roResult.Hosts.Count);
+ Assert.AreEqual(ro.Hosts.Join(roResult.Hosts, h => new {h.Host, h.Port, h.ServiceName}, hr => new {hr.Host, hr.Port, hr.ServiceName}, (h, hr) => hr).Count(), roResult.Hosts.Count);
+ Assert.AreEqual(roResult.Hosts[0].AdditionalProperties["ho1Key"], "ho1Value");
+ Assert.AreEqual(roResult.Hosts[1].AdditionalProperties["ho2Key"], "ho2Value");
+ Assert.AreEqual(roResult.AdditionalProperties["roKey"], "roValue");
+ Assert.AreEqual(ro.PreferredEnvironment, "pe1");
+ Assert.AreEqual(roResult.PreferredEnvironment, "pe2");
+ }
+ }
+}