Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for GeoLoc Serialization in Different Cultures #234

Merged
merged 3 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
});
}
}
}