public void organisation_get_json_with_app_path_test() { // arrange var mediaFormatter = new JsonHalMediaTypeOutputFormatter( new JsonSerializerSettings { Formatting = Formatting.Indented }, ArrayPool <char> .Shared); var resourceWithAppPath = new OrganisationWithAppPathRepresentation(1, "Org Name"); // act using (var stream = new StringWriter()) { mediaFormatter.WriteObject(stream, resourceWithAppPath); string serialisedResult = stream.ToString(); // assert this.Assent(serialisedResult); } }
public void organisation_get_json_with_app_path_test() { // arrange var mediaFormatter = new JsonHalMediaTypeFormatter { Indent = true }; var content = new StringContent(string.Empty); var resourceWithAppPath = new OrganisationWithAppPathRepresentation(1, "Org Name"); var type = resourceWithAppPath.GetType(); // act using (var stream = new MemoryStream()) { mediaFormatter.WriteToStreamAsync(type, resourceWithAppPath, stream, content, null); stream.Seek(0, SeekOrigin.Begin); var serialisedResult = new StreamReader(stream).ReadToEnd(); // assert Approvals.Verify(serialisedResult, s => s.Replace("\r\n", "\n")); } }