Skip to content

Commit

Permalink
Bugfix for GeoLoc Serialization in Different Cultures (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusmuntean authored Oct 13, 2022
1 parent 3ef88ec commit 8de13aa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ We'd love your contributions! If you want to contribute please read our [Contrib
* [@AmirEsdeki](https://github.com/AmirEsdeki)
* [@Zulander1](https://github.com/zulander1)
* [@Jeevananthan](https://github.com/Jeevananthan-23)
* [@mariusmuntean](https://github.com/mariusmuntean)

<!-- Logo -->
[Logo]: images/logo.svg
Expand Down
2 changes: 1 addition & 1 deletion src/Redis.OM/GeoLoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static GeoLoc Parse(string geolocString)
/// <inheritdoc/>
public override string ToString()
{
return $"{Longitude},{Latitude}";
return $"{Longitude.ToString(CultureInfo.InvariantCulture)},{Latitude.ToString(CultureInfo.InvariantCulture)}";
}
}
}
6 changes: 3 additions & 3 deletions src/Redis.OM/Redis.OM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<RootNamespace>Redis.OM</RootNamespace>
<Nullable>enable</Nullable>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PackageVersion>0.3.0</PackageVersion>
<Version>0.3.0</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.3.0</PackageReleaseNotes>
<PackageVersion>0.3.1</PackageVersion>
<Version>0.3.1</Version>
<PackageReleaseNotes>https://github.com/redis/redis-om-dotnet/releases/tag/v0.3.1</PackageReleaseNotes>
<Description>Object Mapping and More for Redis</Description>
<Title>Redis OM</Title>
<Authors>Steve Lorello</Authors>
Expand Down
14 changes: 14 additions & 0 deletions test/Redis.OM.Unit.Tests/GeoLocTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Text.Json;
using Redis.OM.Modeling;
using Xunit;

namespace Redis.OM.Unit.Tests
Expand Down Expand Up @@ -39,5 +40,18 @@ public void TestInvariantCultureParsingFromFormattedHash()
{
Helper.RunTestUnderDifferentCulture("it-IT", x => TestParsingFromFormattedHash());
}

[Theory]
[InlineData("en-DE")]
[InlineData("it-IT")]
public void TestToStringInOtherCultures(string lcid)
{
Helper.RunTestUnderDifferentCulture(lcid, o =>
{
var geoLoc = new GeoLoc(45.2, 11.9);
var geoLocStr = geoLoc.ToString();
Assert.Equal("45.2,11.9", geoLocStr);
});
}
}
}

0 comments on commit 8de13aa

Please sign in to comment.