public void should_return_string_data_and_string_metadata_if_both_were_written_as_string_using_xml_write() { var request = FakeRequest.GetXmlWrite("data", "metadata"); var events = AutoEventConverter.SmartParse(request, Codec.EventsXml, Guid.Empty); var evnt = events.Single(); var resolvedEvent = GenerateResolvedEvent(evnt.Data, evnt.Metadata); var expected = FakeRequest.GetJsonEventReadResult(resolvedEvent, dataJson: false, metadataJson: false); var converted = AutoEventConverter.SmartFormat(resolvedEvent, Codec.EventJson); Assert.That(converted, Is.EqualTo(expected)); }
public void should_return_xml_data_if_data_was_originally_written_as_jobject_and_metadata_as_string() { var request = FakeRequest.GetJsonWrite(FakeRequest.JsonData, "\"metadata\""); var events = AutoEventConverter.SmartParse(request, Codec.EventsJson, Guid.Empty); var evnt = events.Single(); var resolvedEvent = GenerateResolvedEvent(evnt.Data, evnt.Metadata); var expected = FakeRequest.GetXmlEventReadResult(resolvedEvent, dataJson: true, metadataJson: false); var converted = AutoEventConverter.SmartFormat(resolvedEvent, Codec.EventXml); Assert.That(converted, Is.EqualTo(expected)); }
public void should_return_xml_data_and_xml_metadata_if_both_were_written_as_xobjects() { var request = FakeRequest.GetXmlWrite(FakeRequest.XmlData, FakeRequest.XmlMetadata); var events = AutoEventConverter.SmartParse(Helper.UTF8NoBom.GetBytes(request), Codec.EventsXml, Guid.Empty); var evnt = events.Single(); var resolvedEvent = GenerateResolvedEvent(evnt.Data, evnt.Metadata); var expected = FakeRequest.GetXmlEventReadResult(resolvedEvent, dataJson: true, metadataJson: true); var converted = AutoEventConverter.SmartFormat(resolvedEvent, Codec.EventXml); Assert.That(converted, Is.EqualTo(expected)); }
public void should_return_json_data_and_json_metadata_if_both_were_written_as_jobjects() { var request = FakeRequest.GetJsonWrite(FakeRequest.JsonData, FakeRequest.JsonMetadata); var events = AutoEventConverter.SmartParse(request, Codec.EventsJson, Guid.Empty); var evnt = events.Single(); var resolvedEvent = GenerateResolvedEvent(evnt.Data, evnt.Metadata); var expected = FakeRequest.GetJsonEventReadResult(resolvedEvent, dataJson: true, metadataJson: true); var converted = AutoEventConverter.SmartFormat(resolvedEvent, Codec.EventJson); Assert.That(converted, Is.EqualTo(expected)); }
public void should_return_json_data_if_data_was_originally_written_as_xobject_and_metadata_as_string() { var request = FakeRequest.GetXmlWrite(FakeRequest.XmlData, "metadata"); var events = AutoEventConverter.SmartParse(Helper.UTF8NoBom.GetBytes(request), Codec.EventsXml, Guid.Empty); var evnt = events.Single(); var resolvedEvent = GenerateResolvedEvent(evnt.Data, evnt.Metadata); var expected = FakeRequest.GetJsonEventReadResult(resolvedEvent, dataJson: true, metadataJson: false); var converted = AutoEventConverter.SmartFormat(resolvedEvent, Codec.EventJson); Assert.That(converted, Is.EqualTo(expected)); }
public void should_return_string_data_and_string_metadata_if_both_were_written_as_string_using_json_events_write() { var request = FakeRequest.GetJsonWrite("\"data\"", "\"metadata\""); var events = AutoEventConverter.SmartParse(Helper.UTF8NoBom.GetBytes(request), Codec.EventsJson, Guid.Empty); var evnt = events.Single(); var resolvedEvent = GenerateResolvedEvent(evnt.Data, evnt.Metadata); var expected = FakeRequest.GetXmlEventReadResult(resolvedEvent, dataJson: false, metadataJson: false); var converted = AutoEventConverter.SmartFormat(resolvedEvent, Codec.EventXml); Assert.That(converted, Is.EqualTo(expected)); }
public void should_return_string_data_and_string_metadata_if_both_were_written_as_string_using_xml_write() { var request = FakeRequest.GetXmlWrite("data", "metadata"); var written = AutoEventConverter.SmartParse(request, Codec.Xml); var evnt = written.Item2.Single(); var readCompleted = GenereteReadCompleted(evnt.Data, evnt.Metadata); var expected = FakeRequest.GetXmlReadResult(readCompleted, dataJson: false, metadataJson: false); var converted = AutoEventConverter.SmartFormat(readCompleted, Codec.Xml); Assert.That(converted, Is.EqualTo(expected)); }
public void should_return_xml_data_and_xml_metadata_if_both_were_written_as_jobjects() { var request = FakeRequest.GetJsonWrite(FakeRequest.JsonData, FakeRequest.JsonMetadata); var written = AutoEventConverter.SmartParse(request, Codec.Json); var evnt = written.Item2.Single(); var readCompleted = GenereteReadCompleted(evnt.Data, evnt.Metadata); var expected = FakeRequest.GetXmlReadResult(readCompleted, dataJson: true, metadataJson: true); var converted = AutoEventConverter.SmartFormat(readCompleted, Codec.Xml); Assert.That(converted, Is.EqualTo(expected)); }
public void should_return_json_metadata_if_metadata_was_originally_written_as_jobject_and_data_as_string() { var request = FakeRequest.GetJsonWrite("\"data\"", FakeRequest.JsonMetadata); var written = AutoEventConverter.SmartParse(request, Codec.Json); var evnt = written.Item2.Single(); var readCompleted = GenereteReadCompleted(evnt.Data, evnt.Metadata); var expected = FakeRequest.GetJsonReadResult(readCompleted, dataJson: false, metadataJson: true); var converted = AutoEventConverter.SmartFormat(readCompleted, Codec.Json); Assert.That(converted, Is.EqualTo(expected)); }