Skip to content

Commit

Permalink
Merge remote branch 'lanwin/typedcollections' into typedcollections
Browse files Browse the repository at this point in the history
Conflicts:
	source/MongoDB.Tests/IntegrationTests/Linq/LinqDomain.cs
	source/MongoDB.Tests/IntegrationTests/Linq/MongoQueryTests.cs
  • Loading branch information
craiggwilson committed May 5, 2010
2 parents ba975aa + 3f5f34c commit 8badcab
Show file tree
Hide file tree
Showing 35 changed files with 560 additions and 457 deletions.
24 changes: 0 additions & 24 deletions UpgradeLog.XML

This file was deleted.

15 changes: 10 additions & 5 deletions source/MongoDB.Tests/IntegrationTests/Linq/LinqDomain.cs
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace MongoDB.IntegrationTests.Linq
{
Expand Down Expand Up @@ -31,6 +28,14 @@ public class Address
//[MongoAlias("city")]
public string City { get; set; }

public bool IsInternational { get; set; }
public bool IsInternational { get; set; }

public AddressType AddressType { get; set; }
}

public enum AddressType
{
Company,
Private
}
}
12 changes: 5 additions & 7 deletions source/MongoDB.Tests/IntegrationTests/Linq/LinqTestsBase.cs
@@ -1,6 +1,4 @@
using System.Collections.Generic;
using MongoDB.Attributes;
using NUnit.Framework;
using NUnit.Framework;

namespace MongoDB.IntegrationTests.Linq
{
Expand All @@ -11,14 +9,14 @@ public override string TestCollections
get { return "people"; }
}

protected IMongoCollection<Person> collection;
protected IMongoCollection documentCollection;
protected IMongoCollection<Person> Collection;
protected IMongoCollection DocumentCollection;

[SetUp]
public virtual void TestSetup()
{
collection = DB.GetCollection<Person>("people");
documentCollection = DB.GetCollection("people");
Collection = DB.GetCollection<Person>("people");
DocumentCollection = DB.GetCollection("people");
}
}
}
20 changes: 10 additions & 10 deletions source/MongoDB.Tests/IntegrationTests/Linq/MapReduceTests.cs
Expand Up @@ -17,8 +17,8 @@ public override void TestSetup()
{
base.TestSetup();

collection.Delete(new { }, true);
collection.Insert(
Collection.Delete(new { }, true);
Collection.Insert(
new Person
{
FirstName = "Bob",
Expand All @@ -34,7 +34,7 @@ public override void TestSetup()
EmployerIds = new[] { 1, 2 }
}, true);

collection.Insert(
Collection.Insert(
new Person
{
FirstName = "Jane",
Expand All @@ -49,7 +49,7 @@ public override void TestSetup()

}, true);

collection.Insert(
Collection.Insert(
new Person
{
FirstName = "Joe",
Expand All @@ -68,23 +68,23 @@ public override void TestSetup()
[Test]
public void Off_of_select()
{
var minAge = collection.Linq().Select(x => x.Age).Min();
var minAge = Collection.Linq().Select(x => x.Age).Min();

Assert.AreEqual(21, minAge);
}

[Test]
public void Off_of_root()
{
var minAge = collection.Linq().Min(x => x.Age);
var minAge = Collection.Linq().Min(x => x.Age);

Assert.AreEqual(21, minAge);
}

[Test]
public void NoGrouping()
{
var grouping = Enumerable.ToList(from p in collection.Linq()
var grouping = Enumerable.ToList(from p in Collection.Linq()
where p.Age > 21
group p by 1 into g
select new
Expand All @@ -107,7 +107,7 @@ select new
[Test]
public void Expression_Grouping()
{
var grouping = Enumerable.ToList(from p in collection.Linq()
var grouping = Enumerable.ToList(from p in Collection.Linq()
group p by p.Age % 2 into g
select new
{
Expand All @@ -132,7 +132,7 @@ select new
[Test]
public void Expression_Grouping2()
{
var grouping = Enumerable.ToList(from p in collection.Linq()
var grouping = Enumerable.ToList(from p in Collection.Linq()
group p by p.FirstName[0] into g
select new
{
Expand All @@ -153,7 +153,7 @@ select new
[Test]
public void Complex()
{
var grouping = Enumerable.ToList(from p in collection.Linq()
var grouping = Enumerable.ToList(from p in Collection.Linq()
where p.Age > 21
group p by new { FirstName = p.FirstName, LastName = p.LastName } into g
select new
Expand Down

0 comments on commit 8badcab

Please sign in to comment.