Npgsql.Tests.TestUtil.IgnoreExceptOnBuildServer C# (CSharp) Method

IgnoreExceptOnBuildServer() public static method

Calls Assert.Ignore() unless we're on the build server, in which case calls Assert.Fail(). We don't to miss any regressions just because something was misconfigured at the build server and caused a test to be inconclusive.
public static IgnoreExceptOnBuildServer ( string message ) : void
message string
return void
        public static void IgnoreExceptOnBuildServer(string message)
        {
            if (IsOnBuildServer)
                Assert.Fail(message);
            else
                Assert.Ignore(message);
        }

Usage Example

示例#1
0
        public async Task TimeoutSwitchConnection()
        {
            using (var conn = new NpgsqlConnection(ConnectionString))
            {
                if (conn.CommandTimeout >= 100 && conn.CommandTimeout < 105)
                {
                    TestUtil.IgnoreExceptOnBuildServer("Bad default command timeout");
                }
            }

            using (var c1 = await OpenConnectionAsync(ConnectionString + ";CommandTimeout=100"))
            {
                using (var cmd = c1.CreateCommand())
                {
                    Assert.That(cmd.CommandTimeout, Is.EqualTo(100));
                    using (var c2 = new NpgsqlConnection(ConnectionString + ";CommandTimeout=101"))
                    {
                        cmd.Connection = c2;
                        Assert.That(cmd.CommandTimeout, Is.EqualTo(101));
                    }
                    cmd.CommandTimeout = 102;
                    using (var c2 = new NpgsqlConnection(ConnectionString + ";CommandTimeout=101"))
                    {
                        cmd.Connection = c2;
                        Assert.That(cmd.CommandTimeout, Is.EqualTo(102));
                    }
                }
            }
        }
All Usage Examples Of Npgsql.Tests.TestUtil::IgnoreExceptOnBuildServer