From de8c4cc66892a608559dfecb3c2651a45184edf9 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 22 Jul 2024 19:32:59 +1000 Subject: [PATCH] fix Refernce typos (#5155) --- .../JsonDataSerializerTests.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/JsonDataSerializerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/JsonDataSerializerTests.cs index 05a8c8650f..fed8fb3d84 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/JsonDataSerializerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/JsonDataSerializerTests.cs @@ -49,16 +49,16 @@ public void SerializePayloadShouldNotPickDefaultSettings(int version) var classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(null); classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(classWithSelfReferencingLoop); - classWithSelfReferencingLoop.InfiniteRefernce!.InfiniteRefernce = classWithSelfReferencingLoop; + classWithSelfReferencingLoop.InfiniteReference!.InfiniteReference = classWithSelfReferencingLoop; string serializedPayload = _jsonDataSerializer.SerializePayload("dummy", classWithSelfReferencingLoop, version); if (version <= 1) { - Assert.AreEqual("{\"MessageType\":\"dummy\",\"Payload\":{\"InfiniteRefernce\":{}}}", serializedPayload); + Assert.AreEqual("{\"MessageType\":\"dummy\",\"Payload\":{\"InfiniteReference\":{}}}", serializedPayload); } else { - Assert.AreEqual($"{{\"Version\":{version},\"MessageType\":\"dummy\",\"Payload\":{{\"InfiniteRefernce\":{{}}}}}}", serializedPayload); + Assert.AreEqual($"{{\"Version\":{version},\"MessageType\":\"dummy\",\"Payload\":{{\"InfiniteReference\":{{}}}}}}", serializedPayload); } JsonConvert.DefaultSettings = null; @@ -76,7 +76,7 @@ public void DeserializeMessageShouldNotPickDefaultSettings() PreserveReferencesHandling = PreserveReferencesHandling.All, }; - Message message = _jsonDataSerializer.DeserializeMessage("{\"MessageType\":\"dummy\",\"Payload\":{\"InfiniteRefernce\":{}}}"); + Message message = _jsonDataSerializer.DeserializeMessage("{\"MessageType\":\"dummy\",\"Payload\":{\"InfiniteReference\":{}}}"); Assert.AreEqual("dummy", message?.MessageType); JsonConvert.DefaultSettings = null; } @@ -137,7 +137,7 @@ public void DeserializePayloadIsUnaffectedByJsonConverterDefaultSettings(int ver }; // This line should deserialize properly - Message message = _jsonDataSerializer.DeserializeMessage($"{{\"Version\":\"{version}\",\"MessageType\":\"dummy\",\"Payload\":{{\"InfiniteRefernce\":{{}}}}}}"); + Message message = _jsonDataSerializer.DeserializeMessage($"{{\"Version\":\"{version}\",\"MessageType\":\"dummy\",\"Payload\":{{\"InfiniteReference\":{{}}}}}}"); //restore the default settings to null @@ -150,7 +150,7 @@ public void SerializePayloadShouldSerializeAnObjectWithSelfReferencingLoop() { var classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(null); classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(classWithSelfReferencingLoop); - classWithSelfReferencingLoop.InfiniteRefernce!.InfiniteRefernce = classWithSelfReferencingLoop; + classWithSelfReferencingLoop.InfiniteReference!.InfiniteReference = classWithSelfReferencingLoop; // This line should not throw exception _jsonDataSerializer.SerializePayload("dummy", classWithSelfReferencingLoop); @@ -161,7 +161,7 @@ public void DeserializeShouldDeserializeAnObjectWhichHadSelfReferencingLoopBefor { var classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(null); classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(classWithSelfReferencingLoop); - classWithSelfReferencingLoop.InfiniteRefernce!.InfiniteRefernce = classWithSelfReferencingLoop; + classWithSelfReferencingLoop.InfiniteReference!.InfiniteReference = classWithSelfReferencingLoop; var json = _jsonDataSerializer.SerializePayload("dummy", classWithSelfReferencingLoop); @@ -169,7 +169,7 @@ public void DeserializeShouldDeserializeAnObjectWhichHadSelfReferencingLoopBefor var result = _jsonDataSerializer.Deserialize(json, 1)!; Assert.AreEqual(typeof(ClassWithSelfReferencingLoop), result.GetType()); - Assert.IsNull(result.InfiniteRefernce); + Assert.IsNull(result.InfiniteReference); } [TestMethod] @@ -255,9 +255,9 @@ public class ClassWithSelfReferencingLoop { public ClassWithSelfReferencingLoop(ClassWithSelfReferencingLoop? ir) { - InfiniteRefernce = ir; + InfiniteReference = ir; } - public ClassWithSelfReferencingLoop? InfiniteRefernce { get; set; } + public ClassWithSelfReferencingLoop? InfiniteReference { get; set; } } }