Ejemplo n.º 1
0
        public void ParseLogEvents(LogLevel level, string subscriptionId, string appName, string functionName, string eventName, string source, string details, string summary, string exceptionType, string exceptionMessage, string functionInvocationId, string hostInstanceId, string activityId)
        {
            _generator.LogFunctionTraceEvent(level, subscriptionId, appName, functionName, eventName, source, details, summary, exceptionType, exceptionMessage, functionInvocationId, hostInstanceId, activityId);

            string evt = _events.Single();

            evt = JsonSerializeEvent(evt);

            Regex regex = new Regex(LinuxContainerEventGenerator.TraceEventRegex);
            var   match = regex.Match(evt);

            Assert.True(match.Success);
            Assert.Equal(16, match.Groups.Count);

            DateTime dt;
            var      groupMatches = match.Groups.Select(p => p.Value).Skip(1).ToArray();

            Assert.Collection(groupMatches,
                              p => Assert.Equal((int)LinuxEventGenerator.ToEventLevel(level), int.Parse(p)),
                              p => Assert.Equal(subscriptionId, p),
                              p => Assert.Equal(appName, p),
                              p => Assert.Equal(functionName, p),
                              p => Assert.Equal(eventName, p),
                              p => Assert.Equal(source, p),
                              p => Assert.Equal(details, JsonUnescape(p)),
                              p => Assert.Equal(summary, JsonUnescape(p)),
                              p => Assert.Equal(ScriptHost.Version, p),
                              p => Assert.True(DateTime.TryParse(p, out dt)),
                              p => Assert.Equal(exceptionType, p),
                              p => Assert.Equal(exceptionMessage, JsonUnescape(p)),
                              p => Assert.Equal(functionInvocationId, p),
                              p => Assert.Equal(hostInstanceId, p),
                              p => Assert.Equal(activityId, p));
        }
Ejemplo n.º 2
0
        public void ParseLogEvents(LogLevel level, string subscriptionId, string appName, string functionName, string eventName, string source, string details, string summary, string exceptionType, string exceptionMessage, string functionInvocationId, string hostInstanceId, string activityId, string runtimeSiteName, string slotName)
        {
            _generator.LogFunctionTraceEvent(level, subscriptionId, appName, functionName, eventName, source, details, summary, exceptionType, exceptionMessage, functionInvocationId, hostInstanceId, activityId, runtimeSiteName, slotName, DateTime.UtcNow);

            Regex  regex = new Regex(LinuxContainerEventGenerator.TraceEventRegex);
            string evt   = _events.Single();
            var    match = regex.Match(evt);

            Assert.True(match.Success);
            Assert.Equal(21, match.Groups.Count);

            DateTime dt;
            var      groupMatches = match.Groups.Cast <Group>().Select(p => p.Value).Skip(1).ToArray();

            Assert.Collection(groupMatches,
                              p => Assert.Equal((int)LinuxEventGenerator.ToEventLevel(level), int.Parse(p)),
                              p => Assert.Equal(subscriptionId, p),
                              p => Assert.Equal(appName, p),
                              p => Assert.Equal(functionName, p),
                              p => Assert.Equal(eventName, p),
                              p => Assert.Equal(source, p),
                              p => Assert.Equal(details, UnNormalize(p)),
                              p => Assert.Equal(summary, UnNormalize(p)),
                              p => Assert.Equal(ScriptHost.Version, p),
                              p => Assert.True(DateTime.TryParse(p, out dt)),
                              p => Assert.Equal(exceptionType, p),
                              p => Assert.Equal(exceptionMessage, UnNormalize(p)),
                              p => Assert.Equal(functionInvocationId, p),
                              p => Assert.Equal(hostInstanceId, p),
                              p => Assert.Equal(activityId, p),
                              p => Assert.Equal(_containerName.ToUpperInvariant(), p),
                              p => Assert.Equal(_stampName, p),
                              p => Assert.Equal(_tenantId, p),
                              p => Assert.Equal(runtimeSiteName, p),
                              p => Assert.Equal(slotName, p));
        }