public void read_and_write_json() { var message = new Message { Color = "Blue", Direction = "East" }; var response = _application.Endpoints.PostJson(message, contentType: "text/json", accept: "text/json"); response.StatusCodeShouldBe(HttpStatusCode.OK); response.ContentType.ShouldEqual("text/json"); response.ReadAsJson<Message>().ShouldEqual(message); }
public void read_and_write_xml() { var message = new Message { Color = "Blue", Direction = "East" }; var response = _application.Endpoints.PostXml(message, contentType: "text/xml", accept: "text/xml"); response.StatusCodeShouldBe(HttpStatusCode.OK); response.ContentType.ShouldEqual("text/xml"); var serializer = new XmlSerializer(typeof(Message)); serializer.Deserialize(new XmlTextReader(new StringReader(response.ReadAsText()))).ShouldEqual(message); }
public bool Equals(Message other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Color, Color) && Equals(other.Direction, Direction); }
public Message post_message(Message message) { return message; }