Exemplo n.º 1
0
        public void ReadFile_ExecutorLogRecord()
        {
            string file   = Path.Combine(TestContext.CurrentContext.TestDirectory, "Sql.0.json");
            var    parser = new Json.JsonLogParser();
            var    data   = parser.ReadFile <ExecutorLogRecord>(file).ToList();

            data.Count.Should().Be(18);
            data.Any(d => string.IsNullOrWhiteSpace(d.Exception) && (string.IsNullOrWhiteSpace(d.MessageObject.Sql) ||
                                                                     string.IsNullOrWhiteSpace(d.MessageObject.StackTrace))).Should().BeFalse();
            data.Any(d => d.Date == default(DateTime)).Should().BeFalse();
            data.Any(d => d.GetSourceLogHash() == null).Should().BeFalse();
        }
Exemplo n.º 2
0
        public void ReadFile_PerfomanceLogRecord()
        {
            string file   = Path.Combine(TestContext.CurrentContext.TestDirectory, "PerformanceLogger.0.json");
            var    parser = new Json.JsonLogParser();
            var    data   = parser.ReadFile <PerformanceLogRecord>(file).ToList();

            data.Count.Should().Be(3935);
            data.Any(d => string.IsNullOrEmpty(d.UserName)).Should().BeFalse();
            data.Any(d => string.IsNullOrEmpty(d.Thread)).Should().BeFalse();
            data.Any(d => d.MessageObject == null).Should().BeFalse();
            data.Any(d => d.Date == default(DateTime)).Should().BeFalse();
            data.Any(d => d.GetSourceLogHash() == null).Should().BeFalse();
            data.Any(d => d.MessageObject.Id == Guid.Empty).Should().BeFalse();
            data.Any(d => string.IsNullOrWhiteSpace(d.MessageObject.Code)).Should().BeFalse();
            var validParents = new HashSet <Guid>(data.Select(d => d.MessageObject.Id))
            {
                Guid.Empty
            };

            data.Any(d => !validParents.Contains(d.MessageObject.ParentId)).Should().BeFalse();
        }