Ejemplo n.º 1
0
        public void CreateJsonFromRequestString()
        {
            TestEntryFull originalEntry = TestEntryFull.Create();

            string requestString = JsonConvert.SerializeObject(originalEntry);

            QueueEntry requestEntry = QueueEntry.FromRequestString(new QueueContext("x"), requestString, Int32.MaxValue);

            Assert.AreEqual(originalEntry.Tag, requestEntry.Tag);
            Assert.IsTrue(originalEntry.Equals(JsonConvert.DeserializeObject <TestEntryFull>(requestEntry.Data)));
        }
Ejemplo n.º 2
0
        public void CreateJsonFromBytes()
        {
            TestEntryFull originalEntry = TestEntryFull.Create();

            byte[] bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(originalEntry));

            QueueEntry    queueEntry     = QueueEntry.FromBytes(bytes);
            TestEntryFull entryFromBytes = JsonConvert.DeserializeObject <TestEntryFull>(queueEntry.Data);

            Assert.AreEqual(originalEntry.Tag, queueEntry.Tag);
            Assert.IsTrue(originalEntry.Equals(entryFromBytes));
        }