Skip to content

Instantly share code, notes, and snippets.

@haacked
haacked / TestHelper.cs
Created January 14, 2012 07:25
String Comparison Unit Test Helper
public static class TestHelpers
{
public static void ShouldEqualWithDiff(this string actualValue, string expectedValue)
{
ShouldEqualWithDiff(actualValue, expectedValue, DiffStyle.Full, Console.Out);
}
public static void ShouldEqualWithDiff(this string actualValue, string expectedValue, DiffStyle diffStyle)
{
ShouldEqualWithDiff(actualValue, expectedValue, diffStyle, Console.Out);
@meziantou
meziantou / ObjectDataReader.cs
Created February 1, 2017 00:28
ObjectDataReader (BulkInsert)
public class ObjectDataReader<T> : DbDataReader
{
private IEnumerator<T> _iterator;
private IDictionary<string, int> _propertyNameToOrdinal = new Dictionary<string, int>();
private IDictionary<int, string> _ordinalToPropertyName = new Dictionary<int, string>();
private Func<T, object>[] _getPropertyValueFuncs;
public ObjectDataReader(IEnumerator<T> items)
{
_iterator = items ?? throw new ArgumentNullException(nameof(items));