Files
Dapper/Dapper.Tests/Assert.cs
T
Chris Chilvers 9cec884689 actual/expected in asserts are the wrong way round
All the tests are wrote in the form actual.IsEqualTo(expected). This
made for some odd error messages when a test failed.
2016-02-12 22:51:46 +00:00

51 lines
1.3 KiB
C#

using System.Collections.Generic;
namespace Dapper.Tests
{
public static class Assert
{
public static void IsEqualTo<T>(this T actual, T expected)
{
Xunit.Assert.Equal(expected, actual);
}
public static void IsSequenceEqualTo<T>(this IEnumerable<T> actual, IEnumerable<T> expected)
{
Xunit.Assert.Equal(expected, actual ?? new T[0]);
}
public static void IsMoreThan(this int a, int b)
{
Xunit.Assert.True(a > b, $"{a} should be larger than {b}");
}
public static void IsMoreThan(this long a, int b)
{
Xunit.Assert.True(a > b, $"{a} should be larger than {b}");
}
public static void Fail(string message = null)
{
Xunit.Assert.True(false, message ?? "Expectation failed");
}
public static void IsFalse(this bool b)
{
Xunit.Assert.False(b);
}
public static void IsTrue(this bool b)
{
Xunit.Assert.True(b);
}
public static void IsNull(this object obj)
{
Xunit.Assert.Null(obj);
}
public static void IsNotNull(this object obj)
{
Xunit.Assert.NotNull(obj);
}
}
}