public void TestDeserializeEmptySubObjectArray() { string recordString = "TheThings:[]"; ODocument document = ODocument.Deserialize(recordString); TypeMapper <TestHasThings> tm = TypeMapper <TestHasThings> .Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.IsNotNull(t.TheThings, "much easier for consumers to have a consistent behaviour - collections always created but empty, rather than having to test for nullness"); Assert.AreEqual(0, t.TheThings.Length); }
public void TestDeserializeEmptySubObjectArray() { string recordString = "TheThings:[]"; var rawRecord = Encoding.UTF8.GetBytes(recordString); ODocument document = serializer.Deserialize(rawRecord, new ODocument()); TypeMapper <TestHasThings> tm = TypeMapper <TestHasThings> .Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.NotNull(t.TheThings); // much easier for consumers to have a consistent behaviour - collections always created but empty, rather than having to test for nullness Assert.Equal(0, t.TheThings.Length); }
public void TestDeserializeSingleSubObjectArray() { string recordString = "TheThings:[(Value:18,Text:\"foo\")]"; ODocument document = ODocument.Deserialize(recordString); TypeMapper <TestHasThings> tm = TypeMapper <TestHasThings> .Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.IsNotNull(t.TheThings); Assert.AreEqual(1, t.TheThings.Length); Assert.AreEqual(18, t.TheThings[0].Value); Assert.AreEqual("foo", t.TheThings[0].Text); }
public void TestDeserializeSingleSubObjectArray() { string recordString = "TheThings:[(Value:18,Text:\"foo\")]"; var rawRecord = Encoding.UTF8.GetBytes(recordString); ODocument document = serializer.Deserialize(rawRecord, new ODocument()); TypeMapper <TestHasThings> tm = TypeMapper <TestHasThings> .Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.NotNull(t.TheThings); Assert.Equal(1, t.TheThings.Length); Assert.Equal(18, t.TheThings[0].Value); Assert.Equal("foo", t.TheThings[0].Text); }
public void TestSerializeSubObjectArray() { string recordString = "TestHasThings@TheThings:[(Value:17,Text:\"blah\"),(Value:18,Text:\"foo\")]"; ODocument document = ODocument.Deserialize(recordString); TypeMapper <TestHasThings> tm = TypeMapper <TestHasThings> .Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.IsNotNull(t.TheThings); Assert.AreEqual(2, t.TheThings.Length); Assert.AreEqual(18, t.TheThings[1].Value); Assert.AreEqual("foo", t.TheThings[1].Text); ODocument newODocument = ODocument.ToDocument(t); var serialized = newODocument.Serialize(); Assert.AreEqual(recordString, serialized); }
public void TestSerializeSubObjectArray() { string recordString = "TestHasThings@TheThings:[(Value:17,Text:\"blah\"),(Value:18,Text:\"foo\")]"; var rawRecord = Encoding.UTF8.GetBytes(recordString); ODocument document = serializer.Deserialize(rawRecord, new ODocument()); TypeMapper <TestHasThings> tm = TypeMapper <TestHasThings> .Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.NotNull(t.TheThings); Assert.Equal(2, t.TheThings.Length); Assert.Equal(18, t.TheThings[1].Value); Assert.Equal("foo", t.TheThings[1].Text); ODocument newODocument = ODocument.ToDocument(t); var serialized = Encoding.UTF8.GetString(serializer.Serialize(newODocument)); Assert.Equal(recordString, serialized); }
public void TestSerializeEmptySubObjectArray() { string recordString = "TestHasThings@TheThings:[]"; var rawRecord = Encoding.UTF8.GetBytes(recordString); ODocument document = serializer.Deserialize(rawRecord, new ODocument()); TypeMapper<TestHasThings> tm = TypeMapper<TestHasThings>.Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.NotNull(t.TheThings); // much easier for consumers to have a consistent behaviour - collections always created but empty, rather than having to test for nullness Assert.Equal(0, t.TheThings.Length); ODocument newODocument = ODocument.ToDocument(t); var serialized = Encoding.UTF8.GetString(serializer.Serialize(newODocument)); Assert.Equal(recordString, serialized); }
public void TestSerializeSingleSubObjectArray() { string recordString = "TestHasThings@TheThings:[(Value:18,Text:\"foo\")]"; var rawRecord = Encoding.UTF8.GetBytes(recordString); ODocument document = serializer.Deserialize(rawRecord, new ODocument()); TypeMapper<TestHasThings> tm = TypeMapper<TestHasThings>.Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.NotNull(t.TheThings); Assert.Equal(1, t.TheThings.Length); Assert.Equal(18, t.TheThings[0].Value); Assert.Equal("foo", t.TheThings[0].Text); ODocument newODocument = ODocument.ToDocument(t); var serialized = Encoding.UTF8.GetString(serializer.Serialize(newODocument)); Assert.Equal(recordString, serialized); }
public void TestDeserializeSubObjectArray() { string recordString = "TheThings:[(Value:17,Text:\"blah\"),(Value:18,Text:\"foo\")]"; var rawRecord = Encoding.UTF8.GetBytes(recordString); ODocument document = serializer.Deserialize(rawRecord, new ODocument()); TypeMapper<TestHasThings> tm = TypeMapper<TestHasThings>.Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.IsNotNull(t.TheThings); Assert.AreEqual(2, t.TheThings.Length); Assert.AreEqual(18, t.TheThings[1].Value); Assert.AreEqual("foo", t.TheThings[1].Text); }
public void TestSerializeEmptySubObjectArray() { string recordString = "TestHasThings@TheThings:[]"; ODocument document = ODocument.Deserialize(recordString); TypeMapper<TestHasThings> tm = TypeMapper<TestHasThings>.Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.IsNotNull(t.TheThings, "much easier for consumers to have a consistent behaviour - collections always created but empty, rather than having to test for nullness"); Assert.AreEqual(0, t.TheThings.Length); ODocument newODocument = ODocument.ToDocument(t); var serialized = newODocument.Serialize(); Assert.AreEqual(recordString, serialized); }
public void TestSerializeSingleSubObjectArray() { string recordString = "TestHasThings@TheThings:[(Value:18,Text:\"foo\")]"; ODocument document = ODocument.Deserialize(recordString); TypeMapper<TestHasThings> tm = TypeMapper<TestHasThings>.Instance; var t = new TestHasThings(); tm.ToObject(document, t); Assert.IsNotNull(t.TheThings); Assert.AreEqual(1, t.TheThings.Length); Assert.AreEqual(18, t.TheThings[0].Value); Assert.AreEqual("foo", t.TheThings[0].Text); ODocument newODocument = ODocument.ToDocument(t); var serialized = newODocument.Serialize(); Assert.AreEqual(recordString, serialized); }