public static void OverwriteNullTest() { List <String> keys = TraceUtils.TEMP_GetTraceKeys(); SerializableString testStr1 = new SerializableString("{0955D962-2936-4FB2-AAB3-635C6FF6E0AD}"); Dictionary <String, ISerializable> data = new Dictionary <string, ISerializable>(); data.Add(keys[0], testStr1); TraceUtils.SetObjectToTLS(data); //Set complete, readback test var readback = TraceUtils.GetObjectFromTLS(); Assert.IsTrue(((SerializableString)readback[keys[0]]).Payload == testStr1.Payload); data[keys[0]] = null; TraceUtils.SetObjectToTLS(data); //Set complete, readback test readback = TraceUtils.GetObjectFromTLS(); Assert.IsTrue((ISerializable)readback[keys[0]] == null); }
public static void SetGetTest() { List <String> keys = TraceUtils.TEMP_GetTraceKeys(); SerializableString testStr1 = new SerializableString("{0955D962-2936-4FB2-AAB3-635C6FF6E0AD}"); SerializableString testStr2 = new SerializableString("{2D7FE0ED-56F3-47A4-9BAA-8DF570170D97}"); Dictionary <String, ISerializable> data = new Dictionary <string, ISerializable>(); data.Add(keys[0], testStr1); TraceUtils.SetObjectToTLS(data); //Set complete, readback test Dictionary <String, ISerializable> readback = TraceUtils.GetObjectFromTLS(); Assert.IsTrue(((SerializableString)readback[keys[0]]).Payload == testStr1.Payload); }