public void Cannot_deserialize_without_content_type() { var s1 = new SerializeTestClass { Number = 123, Text = "This is some text" }; var frame = new StompFrame(); frame.Serialize(s1); frame.Headers[StompHeader.ContentType] = "text/plain"; try { frame.Deserialize(); Assert.Fail("Expected exception"); } catch (InvalidOperationException ex) { Assert.AreEqual("Cannot deserialize: content-type:text/plain", ex.Message); } }
public void Cannot_deserialize_without_clr_type() { var s1 = new SerializeTestClass { Number = 123, Text = "This is some text" }; var frame = new StompFrame(); frame.Serialize(s1); frame.Headers[StompHeader.NonStandard.ClrType] = null; try { frame.Deserialize(); Assert.Fail("Expected exception"); } catch (InvalidOperationException ex) { Assert.AreEqual("Cannot deserialize: no clr-type specified", ex.Message); } }
public void Serialize() { var s1 = new SerializeTestClass { Number = 123, Text = "This is some text" }; var frame = new StompFrame(); frame.Serialize(s1); var s2 = (SerializeTestClass)frame.Deserialize(); Assert.IsNotNull(s2); Assert.AreEqual(s1.Number, s2.Number); Assert.AreEqual(s1.Text, s2.Text); }