Skip to content

Commit

Permalink
add test for sorting a list
Browse files Browse the repository at this point in the history
  • Loading branch information
mexx committed Jun 12, 2014
1 parent 8da3a90 commit 8489685
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Humanizer.Tests/Bytes/ComparingTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Humanizer.Bytes;
using System.Collections.Generic;
using System.Linq;
using Humanizer.Bytes;
using Xunit;
using Xunit.Extensions;

Expand Down Expand Up @@ -31,5 +33,16 @@ public void CompareUntyped(double value, double valueToCompareWith, int expected

Assert.Equal(expectedResult, result);
}

[Theory]
[InlineData(new[] { "1GB", "3KB", "5MB" }, new[] { "3KB", "5MB", "1GB"})]
[InlineData(new[] { "1MB", "3KB", "5MB" }, new[] { "3KB", "1MB", "5MB"})]
public void SortList(IEnumerable<string> values, IEnumerable<string> expected)
{
var list = values.Select(ByteSize.Parse).ToList();
list.Sort();

Assert.Equal(expected.Select(ByteSize.Parse), list);
}
}
}

0 comments on commit 8489685

Please sign in to comment.