Skip to content

Commit

Permalink
fixed failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
craiggwilson committed May 1, 2010
1 parent 0723354 commit 0e2dfe6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Expand Up @@ -349,6 +349,6 @@ public void Complex_Addition()
var people = Enumerable.ToList<Person>(collection.Linq().Where(x => x.Age + 23 < 50));

Assert.AreEqual(1, people.Count);
}
}
}
}
2 changes: 1 addition & 1 deletion source/MongoDB.Tests/IntegrationTests/TestCollection_1.cs
Expand Up @@ -276,7 +276,7 @@ private class DeletesEntity
};
inserts.Insert(album);

var result = inserts.FindOne(new Document().Add("songs.title", "Deliveries After Dark"));
var result = inserts.FindOne(new Document().Add("Songs.Title", "Deliveries After Dark"));
Assert.IsNotNull(result);

Assert.AreEqual(album.Songs.Count, result.Songs.Count);
Expand Down
Expand Up @@ -81,14 +81,20 @@ protected PersistentMemberMap GetMemberMapFromMemberName(string name)

var parts = name.Split('.');
memberMap = ClassMap.GetMemberMapFromMemberName(parts[0]);
if (memberMap == null)
return null;

var currentType = memberMap.MemberReturnType;
for (int i = 1; i < parts.Length && memberMap != null; i++)
{
if (IsNumeric(parts[i])) //we are an array indexer
var collectionMemberMap = memberMap as CollectionMemberMap;
if (collectionMemberMap != null)
{
currentType = ((CollectionMemberMap)memberMap).ElementType;
continue;
if (IsNumeric(parts[i])) //we are an array indexer
continue;
}

var classMap = _mappingStore.GetClassMap(currentType);
memberMap = classMap.GetMemberMapFromAlias(parts[i]);
if (memberMap != null)
Expand Down Expand Up @@ -136,11 +142,15 @@ protected string GetAliasFromMemberName(string name)
{
if(memberMap != null)
{
if (IsNumeric(parts[i])) //we are an array indexer
var collectionMemberMap = memberMap as CollectionMemberMap;
if (collectionMemberMap != null)
{
currentType = ((CollectionMemberMap)memberMap).ElementType;
sb.Append(".").Append(parts[i]);
continue;
if (IsNumeric(parts[i])) //we are an array indexer
{
sb.Append(".").Append(parts[i]);
continue;
}
}

var classMap = _mappingStore.GetClassMap(currentType);
Expand Down

0 comments on commit 0e2dfe6

Please sign in to comment.