Skip to content

Commit 8de13aa

Browse files
Bugfix for GeoLoc Serialization in Different Cultures (#234)
1 parent 3ef88ec commit 8de13aa

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ We'd love your contributions! If you want to contribute please read our [Contrib
354354
* [@AmirEsdeki](https://github.com/AmirEsdeki)
355355
* [@Zulander1](https://github.com/zulander1)
356356
* [@Jeevananthan](https://github.com/Jeevananthan-23)
357+
* [@mariusmuntean](https://github.com/mariusmuntean)
357358

358359
<!-- Logo -->
359360
[Logo]: images/logo.svg

src/Redis.OM/GeoLoc.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static GeoLoc Parse(string geolocString)
5353
/// <inheritdoc/>
5454
public override string ToString()
5555
{
56-
return $"{Longitude},{Latitude}";
56+
return $"{Longitude.ToString(CultureInfo.InvariantCulture)},{Latitude.ToString(CultureInfo.InvariantCulture)}";
5757
}
5858
}
5959
}

src/Redis.OM/Redis.OM.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<RootNamespace>Redis.OM</RootNamespace>
77
<Nullable>enable</Nullable>
88
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
9-
<PackageVersion>0.3.0</PackageVersion>
10-
<Version>0.3.0</Version>
11-
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.3.0</PackageReleaseNotes>
9+
<PackageVersion>0.3.1</PackageVersion>
10+
<Version>0.3.1</Version>
11+
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.3.1</PackageReleaseNotes>
1212
<Description>Object Mapping and More for Redis</Description>
1313
<Title>Redis OM</Title>
1414
<Authors>Steve Lorello</Authors>

test/Redis.OM.Unit.Tests/GeoLocTests.cs

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Text.Json;
3+
using Redis.OM.Modeling;
34
using Xunit;
45

56
namespace Redis.OM.Unit.Tests
@@ -39,5 +40,18 @@ public void TestInvariantCultureParsingFromFormattedHash()
3940
{
4041
Helper.RunTestUnderDifferentCulture("it-IT", x => TestParsingFromFormattedHash());
4142
}
43+
44+
[Theory]
45+
[InlineData("en-DE")]
46+
[InlineData("it-IT")]
47+
public void TestToStringInOtherCultures(string lcid)
48+
{
49+
Helper.RunTestUnderDifferentCulture(lcid, o =>
50+
{
51+
var geoLoc = new GeoLoc(45.2, 11.9);
52+
var geoLocStr = geoLoc.ToString();
53+
Assert.Equal("45.2,11.9", geoLocStr);
54+
});
55+
}
4256
}
4357
}

0 commit comments

Comments
 (0)