mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-19 14:48:42 +08:00
2b04c22f08
Replicated a bug 'Dapper MultiMap doesn't work with splitOn with NULL value' reported on SO http://stackoverflow.com/q/10744728/449906. Dapper doesn't create an instance of the class if the first property after split is mapped to a column with NULL value.
60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace SqlMapper
|
|
{
|
|
static class Assert
|
|
{
|
|
|
|
public static void IsEqualTo<T>(this T obj, T other)
|
|
{
|
|
if (!obj.Equals(other))
|
|
{
|
|
throw new ApplicationException(string.Format("{0} should be equals to {1}", obj, other));
|
|
}
|
|
}
|
|
|
|
public static void IsSequenceEqualTo<T>(this IEnumerable<T> obj, IEnumerable<T> other)
|
|
{
|
|
if (!obj.SequenceEqual(other))
|
|
{
|
|
throw new ApplicationException(string.Format("{0} should be equals to {1}", obj, other));
|
|
}
|
|
}
|
|
|
|
public static void IsFalse(this bool b)
|
|
{
|
|
if (b)
|
|
{
|
|
throw new ApplicationException("Expected false");
|
|
}
|
|
}
|
|
|
|
public static void IsTrue(this bool b)
|
|
{
|
|
if (!b)
|
|
{
|
|
throw new ApplicationException("Expected true");
|
|
}
|
|
}
|
|
|
|
public static void IsNull(this object obj)
|
|
{
|
|
if (obj != null)
|
|
{
|
|
throw new ApplicationException("Expected null");
|
|
}
|
|
}
|
|
|
|
public static void IsNotNull(this object obj)
|
|
{
|
|
if (obj == null)
|
|
{
|
|
throw new ApplicationException("Expected not null");
|
|
}
|
|
}
|
|
}
|
|
}
|