Skip to content

Commit

Permalink
fixed #24
Browse files Browse the repository at this point in the history
- added reproducing issue
- fixed the code to use invariant culture
  • Loading branch information
desunit committed Jul 30, 2012
1 parent 25e77be commit a6b89d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ServiceStack.Redis/RedisClient_SortedSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using ServiceStack.DesignPatterns.Model;
using ServiceStack.Redis.Support;
Expand Down Expand Up @@ -218,7 +219,7 @@ private static IDictionary<string, double> CreateSortedScoreMap(byte[][] multiDa
{
var key = multiDataList[i].FromUtf8Bytes();
double value;
double.TryParse(multiDataList[i + 1].FromUtf8Bytes(), out value);
double.TryParse(multiDataList[i + 1].FromUtf8Bytes(), NumberStyles.Any, CultureInfo.InvariantCulture, out value);
map[key] = value;
}

Expand Down
14 changes: 14 additions & 0 deletions tests/ServiceStack.Redis.Tests/RedisClientSortedSetTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using ServiceStack.Common.Extensions;
using ServiceStack.Text;
Expand Down Expand Up @@ -233,6 +235,18 @@ public void Can_IncrementItemInSortedSet()
Console.WriteLine(map.Dump());
}

[Test]
public void Can_WorkInSortedSetUnderDifferentCulture()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("ru-RU");
Redis.AddItemToSortedSet(SetId, "key", 123.22);

var map = Redis.GetAllWithScoresFromSortedSet(SetId);

Assert.AreEqual(123.22, map["key"]);
}


[Ignore("Not implemented yet")]
[Test]
public void Can_GetRangeFromSortedSetByHighestScore_from_sorted_set()
Expand Down

0 comments on commit a6b89d0

Please sign in to comment.