Skip to content

Commit

Permalink
Don't rely on HashSet, on Mono it fails to match decimal values
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Massari committed Oct 24, 2016
1 parent 1559fa3 commit 20b8b65
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions NUnitTestProject/TestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1928,14 +1928,14 @@ public void testDB16326()
cmd.CommandText = "insert into tmp values (?, ?)";
cmd.Prepare();

HashSet<decimal> values = new HashSet<decimal>();
values.Add(0m);
values.Add(30000m);
values.Add(-2.3m);
values.Add(-1000000m);
values.Add(13m);
values.Add(0.000034m);
values.Add(-0.01m);
LinkedList<decimal> values = new LinkedList<decimal>();
values.AddLast(0m);
values.AddLast(30000m);
values.AddLast(-2.3m);
values.AddLast(-1000000m);
values.AddLast(13m);
values.AddLast(0.000034m);
values.AddLast(-0.01m);
foreach (decimal d in values)
{
cmd.Parameters[0].Value = d;
Expand All @@ -1949,12 +1949,12 @@ public void testDB16326()
{
decimal d0 = reader.GetDecimal(0);
decimal d1 = reader.GetDecimal(1);
Assert.AreEqual(d0, d1);
bool found = values.Remove(d1);
Assert.IsTrue(found, "Value "+d1+" was not inserted");
Assert.AreEqual(d0, d1, "Decimal(15,6) and number store different values");
decimal expected = values.First.Value;
values.RemoveFirst();
Assert.AreEqual(expected, d1, "Decimal value is different from inserted one");
}
}
Assert.AreEqual(0, values.Count, "Values not found in table: " + values.ToString());
}
}
}
Expand Down

0 comments on commit 20b8b65

Please sign in to comment.