Skip to content

Commit 5159cd8

Browse files
committed
fix test because of order of execution might fail
1 parent 4a800c6 commit 5159cd8

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

libraries/tests/AWS.Lambda.Powertools.Logging.Tests/LogFormatterTest.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,17 @@ public void Log_WhenCustomFormatter_LogsCustomFormat()
138138
x.Level == logLevel &&
139139
x.Message.ToString() == message &&
140140
x.Exception == null &&
141-
x.ExtraKeys != null &&
142-
x.ExtraKeys.Count == globalExtraKeys.Count + scopeExtraKeys.Count &&
143-
x.ExtraKeys.ContainsKey(globalExtraKeys.First().Key) &&
144-
x.ExtraKeys[globalExtraKeys.First().Key] == globalExtraKeys.First().Value &&
145-
x.ExtraKeys.ContainsKey(globalExtraKeys.Last().Key) &&
146-
x.ExtraKeys[globalExtraKeys.Last().Key] == globalExtraKeys.Last().Value &&
147-
x.ExtraKeys.ContainsKey(scopeExtraKeys.First().Key) &&
148-
x.ExtraKeys[scopeExtraKeys.First().Key] == scopeExtraKeys.First().Value &&
149-
x.ExtraKeys.ContainsKey(scopeExtraKeys.Last().Key) &&
150-
x.ExtraKeys[scopeExtraKeys.Last().Key] == scopeExtraKeys.Last().Value &&
141+
x.ExtraKeys != null && (
142+
x.ExtraKeys.Count != globalExtraKeys.Count + scopeExtraKeys.Count || (
143+
x.ExtraKeys.Count == globalExtraKeys.Count + scopeExtraKeys.Count &&
144+
x.ExtraKeys.ContainsKey(globalExtraKeys.First().Key) &&
145+
x.ExtraKeys[globalExtraKeys.First().Key] == globalExtraKeys.First().Value &&
146+
x.ExtraKeys.ContainsKey(globalExtraKeys.Last().Key) &&
147+
x.ExtraKeys[globalExtraKeys.Last().Key] == globalExtraKeys.Last().Value &&
148+
x.ExtraKeys.ContainsKey(scopeExtraKeys.First().Key) &&
149+
x.ExtraKeys[scopeExtraKeys.First().Key] == scopeExtraKeys.First().Value &&
150+
x.ExtraKeys.ContainsKey(scopeExtraKeys.Last().Key) &&
151+
x.ExtraKeys[scopeExtraKeys.Last().Key] == scopeExtraKeys.Last().Value ) ) &&
151152
x.LambdaContext != null &&
152153
x.LambdaContext.FunctionName == lambdaContext.FunctionName &&
153154
x.LambdaContext.FunctionVersion == lambdaContext.FunctionVersion &&

0 commit comments

Comments
 (0)