Fix LogRecordTest by using InvariantCulture. (#1683)

* Fix LogRecordTest by using InvariantCulture.

The test would fail if the current locale used something other than a
dot as the decimal separator (e.g. comma).

* dotnet-format
This commit is contained in:
Christian Neumüller 2021-01-11 18:44:08 +01:00 committed by GitHub
parent 71290dc4d0
commit 3bb0445aa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -21,6 +21,7 @@ using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using Microsoft.Extensions.Logging;
using OpenTelemetry.Exporter;
@ -213,7 +214,16 @@ namespace OpenTelemetry.Tests.Logs
Assert.Contains(state, item => item.Key == "{OriginalFormat}");
Assert.Equal("{food}", state.First(item => item.Key == "{OriginalFormat}").Value);
Assert.Equal("[Name, truffle], [Price, 299.99]", state.ToString());
var prevCulture = CultureInfo.CurrentCulture;
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
try
{
Assert.Equal("[Name, truffle], [Price, 299.99]", state.ToString());
}
finally
{
CultureInfo.CurrentCulture = prevCulture;
}
}
[Fact]