private static Stream CreateStream(Activity activity) { string json = SafeJsonConvert.SerializeObject(activity, MessageSerializerSettings.Create()); var stream = new MemoryStream(); var textWriter = new StreamWriter(stream); textWriter.Write(json); textWriter.Flush(); stream.Seek(0, SeekOrigin.Begin); return(stream); }
public void CheckSerializerSettings() { // used in the integration layer var settings = MessageSerializerSettings.Create(); // connector exposes the serializer settings it uses var connector = new ConnectorClient(new Uri("http://localhost/")); Assert.IsType <DefaultContractResolver>(settings.ContractResolver); Assert.IsType <DefaultContractResolver>(connector.DeserializationSettings.ContractResolver); Assert.IsType <DefaultContractResolver>(connector.SerializationSettings.ContractResolver); }
private static HttpContent CreateContent(Activity activity) { string json = JsonConvert.SerializeObject(activity, MessageSerializerSettings.Create()); return(new StringContent(json, Encoding.UTF8, "application/json")); }