Skip to content

Commit

Permalink
Adding additional logging to .NET ProxyTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Jul 8, 2019
1 parent 438c5fa commit c8caa95
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions dotnet/test/common/ProxyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void ManualProxyToJson()
string jsonValue = JsonConvert.SerializeObject(proxy);
JObject json = JObject.Parse(jsonValue);

Assert.That(json.ContainsKey("proxyType"), Is.True);
Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue);
Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String));
Assert.That(json["proxyType"].Value<string>(), Is.EqualTo("manual"));

Expand Down Expand Up @@ -262,9 +262,9 @@ public void PacProxyToJson()
JObject json = JObject.Parse(jsonValue);


Assert.That(json.ContainsKey("proxyType"), Is.True);
Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String));
Assert.That(json["proxyType"].Value<string>(), Is.EqualTo("pac"));
Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue);
Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String), "proxyType is not a string - JSON = {0}", jsonValue);
Assert.That(json["proxyType"].Value<string>(), Is.EqualTo("pac"), "proxyType not 'pac' - JSON = {0}", jsonValue);

Assert.That(json.ContainsKey("proxyAutoconfigUrl"), Is.True);
Assert.That(json["proxyAutoconfigUrl"].Type, Is.EqualTo(JTokenType.String));
Expand Down Expand Up @@ -302,13 +302,15 @@ public void AutoDetectProxyToJson()
proxy.Kind = ProxyKind.AutoDetect;
proxy.IsAutoDetect = true;

JsonSerializerSettings settings = new JsonSerializerSettings();

string jsonValue = JsonConvert.SerializeObject(proxy);
JObject json = JObject.Parse(jsonValue);

Assert.That(json.ContainsKey("proxyType"), Is.True);
Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String));
Assert.That(json["proxyType"].Value<string>(), Is.EqualTo("autodetect"));
Assert.That(json.Count, Is.EqualTo(1));
Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue);
Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String), "proxyType is not a string - JSON = {0}", jsonValue);
Assert.That(json["proxyType"].Value<string>(), Is.EqualTo("autodetect"), "proxyType not 'autodetect' - JSON = {0}", jsonValue);
Assert.That(json.Count, Is.EqualTo(1), "more than one object in serialization - JSON = {0}", jsonValue);
}

[Test]
Expand Down Expand Up @@ -342,10 +344,10 @@ public void SystemProxyToJson()
string jsonValue = JsonConvert.SerializeObject(proxy);
JObject json = JObject.Parse(jsonValue);

Assert.That(json.ContainsKey("proxyType"), Is.True);
Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String));
Assert.That(json["proxyType"].Value<string>(), Is.EqualTo("system"));
Assert.That(json.Count, Is.EqualTo(1));
Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue);
Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String), "proxyType is not a string - JSON = {0}", jsonValue);
Assert.That(json["proxyType"].Value<string>(), Is.EqualTo("system"), "proxyType not 'system' - JSON = {0}", jsonValue);
Assert.That(json.Count, Is.EqualTo(1), "more than one object in serialization - JSON = {0}", jsonValue);
}

[Test]
Expand Down Expand Up @@ -379,10 +381,10 @@ public void DirectProxyToJson()
string jsonValue = JsonConvert.SerializeObject(proxy);
JObject json = JObject.Parse(jsonValue);

Assert.That(json.ContainsKey("proxyType"), Is.True);
Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String));
Assert.That(json["proxyType"].Value<string>(), Is.EqualTo("direct"));
Assert.That(json.Count, Is.EqualTo(1));
Assert.That(json.ContainsKey("proxyType"), Is.True, "proxyType not set - JSON = {0}", jsonValue);
Assert.That(json["proxyType"].Type, Is.EqualTo(JTokenType.String), "proxyType is not a string - JSON = {0}", jsonValue);
Assert.That(json["proxyType"].Value<string>(), Is.EqualTo("direct"), "proxyType not 'direct' - JSON = {0}", jsonValue);
Assert.That(json.Count, Is.EqualTo(1), "more than one object in serialization - JSON = {0}", jsonValue);
}

[Test]
Expand Down

0 comments on commit c8caa95

Please sign in to comment.