public void FormatResponse() { Model model = CreateModel(); var formatter = new FormsFormatter(); Assert.That(formatter.CanFormatResponse, Is.False); // "application/x-www-form-urlencoded" be used as an accepted media type Assert.Throws(typeof(NotSupportedException), () => formatter.FormatResponse(m_context, typeof(Model), model, null)); }
public void FormatRequest() { Model model = CreateModel(); WriteBodyAsFormsEncodedString(model); var formatter = new FormsFormatter(); var resource = formatter.FormatRequest(m_context, typeof(Model)) as Model; Assert.That(resource, Is.Not.Null); Assert.That(resource.Id, Is.EqualTo(model.Id)); Assert.That(resource.Name, Is.EqualTo(model.Name)); Assert.That(resource.Items, Is.Not.Null); CollectionAssert.AreEqual(model.Items, resource.Items); }