Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (33 sloc) 0.805 kB
using System.Linq;
using NUnit.Framework;
namespace NHibernate.Test.Linq.ByMethod
{
[TestFixture]
public class GetValueOrDefaultTests : LinqTestCase
{
[Test]
public void CoalesceInWhere()
{
var orders = db.Orders
.Where(x => (x.Freight ?? 100) > 0)
.ToList();
Assert.AreEqual(830, orders.Count);
}
[Test]
public void GetValueOrDefaultInWhere()
{
var orders = db.Orders
.Where(x => x.Freight.GetValueOrDefault(100) > 0)
.ToList();
Assert.AreEqual(830, orders.Count);
}
[Test]
public void GetValueOrDefaultWithSingleArgumentInWhere()
{
var orders = db.Orders
.Where(x => x.Freight.GetValueOrDefault() > 0)
.ToList();
Assert.AreEqual(830, orders.Count);
}
}
}
Jump to Line
Something went wrong with that request. Please try again.