Permalink
Browse files

Fixed issue #167

  • Loading branch information...
1 parent c86482a commit c532dc4ce95402b66f1c1a22e99ef208506d680f @markrendle markrendle committed Mar 16, 2012
@@ -1,5 +1,6 @@
namespace Simple.Data.Ado
{
+ using System;
using System.Collections.Generic;
internal static class ListExtensions
@@ -8,7 +9,18 @@ public static void SetWithBuffer<T>(this List<T> list, int index, T value)
{
if (list.Capacity > index)
{
- list[index] = value;
+ while (list.Count < index)
+ {
+ list.Add(default(T));
+ }
+ if (list.Count == index)
+ {
+ list.Add(value);
+ }
+ else
+ {
+ list[index] = value;
+ }
}
else
{
Binary file not shown.
@@ -44,5 +44,20 @@ public void DistinctShouldReturnDistinctList()
Assert.AreEqual(countries.Distinct().Count(), countries.Count);
}
+
+ [Test]
+ public void NestedFindAllIssue167()
+ {
+ var db = Database.OpenFile(DatabasePath);
+
+ List<dynamic> customers = db.Customers.All().ToList();
+
+ foreach (var customer in customers)
+ {
+ customer.Orders = db.Orders.FindAllByCustomerID(customer.CustomerID).ToList();
+ }
+
+ Assert.Pass();
+ }
}
}

0 comments on commit c532dc4

Please sign in to comment.