コード例 #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, string runtimeSiteName, string slotName)
        {
            _generator.LogFunctionTraceEvent(level, subscriptionId, appName, functionName, eventName, source, details, summary, exceptionType, exceptionMessage, functionInvocationId, hostInstanceId, activityId, runtimeSiteName, slotName, DateTime.UtcNow);

            var evt = _loggers[LinuxEventGenerator.FunctionsLogsCategory].Events.Single();

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

            Assert.True(match.Success);
            Assert.Equal(17, 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(_hostNameDefault, 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, LinuxContainerEventGeneratorTests.UnNormalize(p)),
                              p => Assert.Equal(summary, LinuxContainerEventGeneratorTests.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, LinuxContainerEventGeneratorTests.UnNormalize(p)),
                              p => Assert.Equal(functionInvocationId, p),
                              p => Assert.Equal(hostInstanceId, p),
                              p => Assert.Equal(activityId, p));
        }
コード例 #2
0
        public void ParseDetailsEvents(string siteName, string functionName, string inputBindings, string outputBindings, string scriptType, bool isDisabled)
        {
            _generator.LogFunctionDetailsEvent(siteName, functionName, inputBindings, outputBindings, scriptType, isDisabled);

            string evt = _loggers[LinuxEventGenerator.FunctionsDetailsCategory].Events.Single();

            Regex regex = new Regex(LinuxAppServiceEventGenerator.DetailsEventRegex);
            var   match = regex.Match(evt);

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

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

            Assert.Collection(groupMatches,
                              p => Assert.Equal(siteName, p),
                              p => Assert.Equal(functionName, p),
                              p => Assert.Equal(inputBindings, LinuxContainerEventGeneratorTests.UnNormalize(p)),
                              p => Assert.Equal(outputBindings, LinuxContainerEventGeneratorTests.UnNormalize(p)),
                              p => Assert.Equal(scriptType, p),
                              p => Assert.Equal(isDisabled ? "1" : "0", p));
        }