Пример #1
0
        public void LogEntrySerialiseDeserialise()
        {
            var originalLogEntry = new LogEntry()
            {
                Timestamp = DateTime.UtcNow,
                Status = LogStatus.Fatal,
                GroupKey = Guid.NewGuid(),
                TargetKey = Guid.NewGuid(),
                InstanceKey = Guid.NewGuid(),
                LogContent = "Test Log Entry",
            };

            LogEntry secondLogEntry;
            using (var stream = originalLogEntry.Serialise())
            {
                secondLogEntry = new LogEntry(stream);
            }

            Assert.AreEqual(originalLogEntry.Timestamp, secondLogEntry.Timestamp);
            Assert.AreEqual(originalLogEntry.Status, secondLogEntry.Status);
            Assert.AreEqual(originalLogEntry.GroupKey, secondLogEntry.GroupKey);
            Assert.AreEqual(originalLogEntry.TargetKey, secondLogEntry.TargetKey);
            Assert.AreEqual(originalLogEntry.InstanceKey, secondLogEntry.InstanceKey);
            Assert.AreEqual(originalLogEntry.LogContent, secondLogEntry.LogContent);
        }