public string Serialize_Object() { // set up BsonFormatter formatter = new BsonFormatter(); ExampleObject expected = new ExampleObject { Number = 42, Text = "fourty-two" }; HttpRequestMessage request = this.GetRequest(expected, formatter); // verify return this.GetSerialized(expected, request, formatter); }
public void Deserialize_Object(string content) { // set up BsonFormatter formatter = new BsonFormatter(); ExampleObject expected = new ExampleObject { Number = 42, Text = "fourty-two" }; HttpRequestMessage request = this.GetRequest(content, formatter); // execute ExampleObject result = (ExampleObject)this.GetDeserialized(typeof(ExampleObject), content, request, formatter); // verify Assert.That(result, Is.Not.Null); Assert.That(result.Number, Is.EqualTo(expected.Number)); Assert.That(result.Text, Is.EqualTo(expected.Text)); }