Files
Dapper/Dapper.Tests/Attributes.cs
Nick Craver e40c788269 nits
2015-11-24 21:44:38 -05:00

61 lines
1.6 KiB
C#

using System;
using System.Data.SqlClient;
using Xunit;
namespace Dapper.Tests
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class FactUnlessCoreCLRAttribute : FactAttribute
{
public FactUnlessCoreCLRAttribute(string url)
{
#if COREFX
Skip = $"CoreFX: {url}";
#endif
this.Url = url;
}
public string Url { get; private set; }
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class FactLongRunningAttribute : FactAttribute
{
public FactLongRunningAttribute()
{
#if !LONG_RUNNING
Skip = "Long running";
#endif
}
public string Url { get; private set; }
}
public class FactUnlessCaseSensitiveDatabaseAttribute : FactAttribute
{
public FactUnlessCaseSensitiveDatabaseAttribute() : base()
{
if (IsCaseSensitive)
{
Skip = "Case sensitive database";
}
}
public static readonly bool IsCaseSensitive;
static FactUnlessCaseSensitiveDatabaseAttribute()
{
using (var conn = TestSuite.GetOpenConnection())
{
try
{
conn.Execute("declare @i int; set @I = 1;");
}
catch (SqlException s)
{
if (s.Number == 137)
IsCaseSensitive = true;
else
throw;
}
}
}
}
}