|
@@ -58,5 +58,26 @@ namespace OhmGraphite.Test
|
|
|
string actual = writer.FormatGraphiteData(epoch, sensor);
|
|
|
Assert.Equal("ohm.MY-PC.my.cpu.identifier.voltage;host=MY-PC;app=ohm;hardware=cpu;hardware_type=CPU;sensor_type=Voltage;sensor_index=1;raw_name=voltage 1.06 979344000", actual);
|
|
|
}
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public void FormatTagsCultureInvariant()
|
|
|
+ {
|
|
|
+ var writer = new GraphiteWriter("localhost", 2003, "MY-PC", true);
|
|
|
+ CultureInfo original = Thread.CurrentThread.CurrentCulture;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // de-DE culture will format 1.06 as 1,06 which graphite doesn't like
|
|
|
+ Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE");
|
|
|
+
|
|
|
+ var epoch = new DateTimeOffset(new DateTime(2001, 1, 13), TimeSpan.Zero).ToUnixTimeSeconds();
|
|
|
+ var sensor = new ReportedValue("/my/cpu/identifier/1", "voltage", 1.06f, SensorType.Voltage, "cpu", HardwareType.CPU, 1);
|
|
|
+ string actual = writer.FormatGraphiteData(epoch, sensor);
|
|
|
+ Assert.Contains("1.06", actual);
|
|
|
+ }
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ Thread.CurrentThread.CurrentCulture = original;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|