ToString() публичный Метод

public ToString ( ISerializer serializer ) : string
serializer ISerializer
Результат string
Пример #1
0
// ReSharper disable InconsistentNaming
        public void MemoParse_UnitTest_Serialization_MemoFromEnvelopeContent()
// ReSharper restore InconsistentNaming
        {
            var memo = new Memo { InstanceID = Guid.NewGuid() };

            var serializer = new Dev2JsonSerializer();

            var envelopeStr = memo.ToString(serializer);
            var actual = Memo.Parse(serializer, envelopeStr) as IMemo;

            Assert.IsNotNull(actual);
            Assert.AreEqual(memo.InstanceID, actual.InstanceID);
            Assert.AreEqual(memo.Date, actual.Date);
        }
Пример #2
0
// ReSharper disable InconsistentNaming
        public void MemoToString_UnitTest_Serialization_EnvelopeWithMemoAsContent()
// ReSharper restore InconsistentNaming
        {
            var memo = new Memo { InstanceID = Guid.NewGuid() };

            var serializer = new Dev2JsonSerializer();

            var actual = memo.ToString(serializer);
            Assert.IsNotNull(actual);

            var actualEnvelope = serializer.Deserialize<Envelope>(actual);
            Assert.IsNotNull(actualEnvelope);

            var actualMemo = serializer.Deserialize<Memo>(actualEnvelope.Content);
            Assert.IsNotNull(actualMemo);
            Assert.AreEqual(memo.InstanceID, actualMemo.InstanceID);
            Assert.AreEqual(memo.Date, actualMemo.Date);
        }