[Mono-list] Test class for SqlBoolean

ville vi64pa@koti.soon.fi
Sun, 29 Sep 2002 18:23:07 +0300


--------------Boundary-00=_JEH7Y5O20ND4L322XXKA
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable


Hi

This is my first testsuite. Its for System.Data.SqlTypes.SqlBoolean.
I hope this is useful. Also comments and suggestions are welcome

ville

--------------Boundary-00=_JEH7Y5O20ND4L322XXKA
Content-Type: text/x-c++src;
  charset="us-ascii";
  name="SqlBooleanTest.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="SqlBooleanTest.cs"

// SqlDataTimeTest.cs - NUnit Test Cases for [explain here]
//
// Ville Palo (vi64pa@users.sourceforge.net)
//
// (C) Ville Palo
// 

using NUnit.Framework;
using System;
using System.Data.SqlTypes;

namespace MonoTests.System.Data.SqlTypes
{
  public class SqlBooleanTest : TestCase {

    public SqlBooleanTest() : base ("System.Data.SqlTypes.SqlBoolean") {}
    public SqlBooleanTest(string name) : base(name) {}

    protected override void SetUp() {}

    protected override void TearDown() {}

    public static ITest Suite {
      get {
         return new TestSuite(typeof(SqlBoolean));
      }
    }

    public void TestCreate ()
    {
      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(1);
      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(0);

      AssertEquals ("Creation of SqlBoolean failed", SqlTrue.Value, true);
      AssertEquals ("Creation of SqlBoolean failed", SqlTrue2.Value, true);
      AssertEquals ("Creation of SqlBoolean failed", SqlFalse.Value, false);
      AssertEquals ("Creation of SqlBoolean failed", SqlFalse2.Value, false);

    }

    ////
    // PUBLIC STATIC METHODS
    //

    // And
    public void TestAnd() {

      // Two true values
      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);

      // Two false values
      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      // One result value
      SqlBoolean sqlResult;

      // true && false
      sqlResult = SqlBoolean.And(SqlTrue, SqlFalse);
      AssertEquals("And method does not work correctly (true && false)", sqlResult.Value, false);
      sqlResult = SqlBoolean.And(SqlFalse, SqlTrue);
      AssertEquals("And method does not work correctly (false && true)", sqlResult.Value, false);

      // true && true
      sqlResult = SqlBoolean.And(SqlTrue, SqlTrue2);
      AssertEquals("And method does not work correctly (true && true)", sqlResult.Value, true);

      sqlResult = SqlBoolean.And(SqlTrue, SqlTrue);
      AssertEquals("And method does not work correctly (true && true2)", sqlResult.Value, true);

      // false && false
      sqlResult = SqlBoolean.And(SqlFalse, SqlFalse2);
      AssertEquals("And method does not work correctly (false && false)", sqlResult.Value, false);
      sqlResult = SqlBoolean.And(SqlFalse, SqlFalse);
      AssertEquals("And method does not work correctly (false && false2)", sqlResult.Value, false);

    }

    // NotEquals
    public void TestNotEquals() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);

      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      SqlBoolean SqlResult;

      // true != false
      SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlFalse);
      AssertEquals("NotEquals method does not work correctly (true != false)", SqlResult.Value, true);
      SqlResult = SqlBoolean.NotEquals(SqlFalse, SqlTrue);
      AssertEquals("NotEquals method does not work correctly (false != true)", SqlResult.Value, true);


      // true != true
      SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlTrue);
      AssertEquals("NotEquals method does not work correctly (true != true)", SqlResult.Value, false);
      SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlTrue2);
      AssertEquals("NotEquals method does not work correctly (true != true2)", SqlResult.Value, false);

      // false != false
      SqlResult = SqlBoolean.NotEquals(SqlFalse, SqlFalse);
      AssertEquals("NotEquals method does not work correctly (false != false)", SqlResult.Value, false);
      SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlTrue2);
      AssertEquals("NotEquals method does not work correctly (false != false2)", SqlResult.Value, false);

      // If either instance of SqlBoolean is null, the Value of the SqlBoolean will be Null.
      SqlResult = SqlBoolean.NotEquals(SqlBoolean.Null, SqlFalse);
      AssertEquals("NotEquals method does not work correctly (Null != false)", SqlResult.IsNull, true);
      SqlResult = SqlBoolean.NotEquals(SqlTrue, SqlBoolean.Null);
      AssertEquals("NotEquals method does not work correctly (false != Null)", SqlResult.IsNull, true);

    }

    // OnesComplement
    public void TestOnesComplement() {

      SqlBoolean SqlTrue = new SqlBoolean(true);

      SqlBoolean SqlFalse = SqlBoolean.OnesComplement(SqlTrue);

      AssertEquals("OnesComplement method does not work correctly", SqlFalse.Value, false);

      SqlTrue = SqlBoolean.OnesComplement(SqlFalse);
      AssertEquals("OnesComplement method does not work correctly", SqlTrue.Value, true);

    }

    // Or
    public void TestOr() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);

      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      SqlBoolean SqlResult;

      // true || false
      SqlResult = SqlBoolean.Or(SqlTrue, SqlFalse);
      AssertEquals("Or method does not work correctly (true || false)", SqlResult.Value, true);
      SqlResult = SqlBoolean.Or(SqlFalse, SqlTrue);
      AssertEquals("Or method does not work correctly (false || true)", SqlResult.Value, true);

      // true || true
      SqlResult = SqlBoolean.Or(SqlTrue, SqlTrue);
      AssertEquals("Or method does not work correctly (true || true)", SqlResult.Value, true);
      SqlResult = SqlBoolean.Or(SqlTrue, SqlTrue2);
      AssertEquals("Or method does not work correctly (true || true2)", SqlResult.Value, true);

      // false || false
      SqlResult = SqlBoolean.Or(SqlFalse, SqlFalse);
      AssertEquals("Or method does not work correctly (false || false)", SqlResult.Value, false);
      SqlResult = SqlBoolean.Or(SqlFalse, SqlFalse2);
      AssertEquals("Or method does not work correctly (false || false2)", SqlResult.Value, false);

    }

    //  Parse
    public void TestParse() {

      String error = "Parse method does not work correctly ";
                                                                         
      AssertEquals(error + "(\"True\")", true, SqlBoolean.Parse("True").Value);
      AssertEquals(error + "(\" True\")", true, SqlBoolean.Parse(" True").Value);
      AssertEquals(error + "(\"True \")", true, SqlBoolean.Parse("True ").Value);
      AssertEquals(error + "(\"tRue\")", true, SqlBoolean.Parse("tRuE").Value);
      AssertEquals(error + "(\"False\")", false, SqlBoolean.Parse("False").Value);
      AssertEquals(error + "(\" False\")", false, SqlBoolean.Parse(" False").Value);
      AssertEquals(error + "(\"False \")", false, SqlBoolean.Parse("False ").Value);
      AssertEquals(error + "(\"fAlSe\")", false, SqlBoolean.Parse("fAlSe").Value);

    }

    // Xor
    public void TestXor() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);

      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      SqlBoolean SqlResult;

      // true ^ false
      SqlResult = SqlBoolean.Xor(SqlTrue, SqlFalse);
      AssertEquals("Xor method does not work correctly (true ^ false)", SqlResult.Value, true);
      SqlResult = SqlBoolean.Xor(SqlFalse, SqlTrue);
      AssertEquals("Xor method does not work correctly (false ^ true)", SqlResult.Value, true);

      // true ^ true
      SqlResult = SqlBoolean.Xor(SqlTrue, SqlTrue2);
      AssertEquals("Xor method does not work correctly (true ^ true)", SqlResult.Value, false);

      // false ^ false
      SqlResult = SqlBoolean.Xor(SqlFalse, SqlFalse2);
      AssertEquals("Xor method does not work correctly (false ^ false)", SqlResult.Value, false);

    }

    // static Equals
    public void TestStaticEquals() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);
      String error = "Static Equals method does not work correctly ";

      AssertEquals(error +  "(true == true)", SqlBoolean.Equals(SqlTrue, SqlTrue2).Value, true);
      AssertEquals(error +  "(false == false)", SqlBoolean.Equals(SqlFalse, SqlFalse2).Value, true);

      AssertEquals(error +  "(true == false)", SqlBoolean.Equals(SqlTrue, SqlFalse).Value, false);
      AssertEquals(error +  "(false == true)", SqlBoolean.Equals(SqlFalse, SqlTrue).Value, false);

      AssertEquals(error +  "(null == false)", SqlBoolean.Equals(SqlBoolean.Null, SqlFalse), SqlBoolean.Null);
      AssertEquals(error +  "(true == null)", SqlBoolean.Equals(SqlTrue, SqlBoolean.Null), SqlBoolean.Null);

    }

    //
    // END OF STATIC METHODS
    ////

    ////
    // PUBLIC METHODS
    //

    // CompareTo
    public void TestCompareTo() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);
      String error = "CompareTo method does not work correctly";

      AssertEquals(error, (SqlTrue.CompareTo(SqlBoolean.Null) > 0), true);
      AssertEquals(error, (SqlTrue.CompareTo(SqlFalse) > 0), true);
      AssertEquals(error, (SqlFalse.CompareTo(SqlTrue) < 0), true);
      AssertEquals(error, (SqlFalse.CompareTo(SqlFalse) == 0), true);

    }

    // Equals
    public void TestEquals() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);

      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      String error = "Equals method does not work correctly ";

      AssertEquals(error + "(true == true)", SqlTrue.Equals(SqlTrue2), true);
      AssertEquals(error + "(false == false)", SqlFalse.Equals(SqlFalse2), true);

      AssertEquals(error + "(true == false)", SqlTrue.Equals(SqlFalse), false);
      AssertEquals(error + "(false == true)", SqlFalse.Equals(SqlTrue), false);

      AssertEquals(error + "(true == false)", SqlTrue.Equals(null), false);

    }

    public void TestGetHashCode() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      AssertEquals("GetHashCode method does not work correctly",
          SqlTrue.GetHashCode(), 1);

      AssertEquals("GetHashCode method does not work correctly",
          SqlFalse.GetHashCode(), 0);

    }

    // GetType
    public void TestGetType() {
      SqlBoolean SqlTrue = new SqlBoolean(true);

      AssertEquals("GetType method does not work correctly",
          SqlTrue.GetType().ToString() == "System.Data.SqlTypes.SqlBoolean", true);
    }

    // ToSqlByte
    public void TestToSqlByte() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlByte SqlTestByte;

      String error = "ToSqlByte method does not work correctly ";

      SqlTestByte = SqlTrue.ToSqlByte();
      AssertEquals(error, SqlTestByte.Value, (byte)1);

      SqlTestByte = SqlFalse.ToSqlByte();
      AssertEquals(error, SqlTestByte.Value, (byte)0);

    }

    // ToSqlDecimal
    public void TestToSqlDecimal() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlDecimal SqlTestDecimal;

      String error = "ToSqlDecimal method does not work correctly ";

      SqlTestDecimal = SqlTrue.ToSqlDecimal();

      AssertEquals(error, SqlTestDecimal.Value, (decimal)1);

      SqlTestDecimal = SqlFalse.ToSqlDecimal();
      AssertEquals(error, SqlTestDecimal.Value, (decimal)0);
    }

    // ToSqlDouble
    public void TestToSqlDouble() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlDouble SqlTestDouble;

      String error = "ToSqlDouble method does not work correctly ";

      SqlTestDouble = SqlTrue.ToSqlDouble();
      AssertEquals(error, SqlTestDouble.Value, (double)1);

      SqlTestDouble = SqlFalse.ToSqlDouble();
      AssertEquals(error, SqlTestDouble.Value, (double)0);
    }

    // ToSqlInt16
    public void TestToSqlInt16() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlInt16 SqlTestInt16;

      String error = "ToSqlInt16 method does not work correctly ";

      SqlTestInt16 = SqlTrue.ToSqlInt16();
      AssertEquals(error, SqlTestInt16.Value, (short)1);

      SqlTestInt16 = SqlFalse.ToSqlInt16();
      AssertEquals(error, SqlTestInt16.Value, (short)0);

    }

    // ToSqlInt32
    public void TestToSqlInt32() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlInt32 SqlTestInt32;

      String error = "ToSqlInt32 method does not work correctly ";

      SqlTestInt32 = SqlTrue.ToSqlInt32();
      AssertEquals(error, SqlTestInt32.Value, (int)1);

      SqlTestInt32 = SqlFalse.ToSqlInt32();
      AssertEquals(error, SqlTestInt32.Value, (int)0);

    }

    // ToSqlInt64
    public void TestToSqlInt64() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlInt64 SqlTestInt64;

      String error = "ToSqlInt64 method does not work correctly ";

      SqlTestInt64 = SqlTrue.ToSqlInt64();
      AssertEquals(error, SqlTestInt64.Value, (long)1);

      SqlTestInt64 = SqlFalse.ToSqlInt64();
      AssertEquals(error, SqlTestInt64.Value, (long)0);

    }

    // ToSqlMoney
    public void TestToSqlMoney() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlMoney SqlTestMoney;

      String error = "ToSqlMoney method does not work correctly ";

      SqlTestMoney = SqlTrue.ToSqlMoney();
      AssertEquals(error, SqlTestMoney.Value, (decimal)1);

      SqlTestMoney = SqlFalse.ToSqlMoney();
      AssertEquals(error, SqlTestMoney.Value, (decimal)0);

    }

    // ToSqlSingle
    public void TestToSqlsingle() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlSingle SqlTestSingle;

      String error = "ToSqlSingle method does not work correctly ";

      SqlTestSingle = SqlTrue.ToSqlSingle();
      AssertEquals(error, SqlTestSingle.Value, (float)1);

      SqlTestSingle = SqlFalse.ToSqlSingle();
      AssertEquals(error, SqlTestSingle.Value, (float)0);

    }

    // ToSqlString
    public void TestToSqlString() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlString SqlTestString;

      String error = "ToSqlString method does not work correctly ";

      SqlTestString = SqlTrue.ToSqlString();
      AssertEquals(error, SqlTestString.Value, "True");

      SqlTestString = SqlFalse.ToSqlString();
      AssertEquals(error, SqlTestString.Value, "False");

    }

    // ToString
    public void TestToString() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      SqlString TestString;

      String error = "ToString method does not work correctly ";

      TestString = SqlTrue.ToString();
      AssertEquals(error, TestString.Value, "True");

      TestString = SqlFalse.ToSqlString();
      AssertEquals(error, TestString.Value, "False");

    }

    // END OF PUBLIC METHODS
    ////

    ////
    // OPERATORS

    // BitwixeAnd operator
    public void TestBitwiseAndOperator() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      SqlBoolean SqlResult;
      String error = "BitwiseAnd operator does not work correctly ";

      SqlResult = SqlTrue & SqlFalse;
      AssertEquals(error + "(true & false)", SqlResult.Value, false);
      SqlResult = SqlFalse & SqlTrue;
      AssertEquals(error + "(false & true)", SqlResult.Value, false);

      SqlResult = SqlTrue & SqlTrue2;
      AssertEquals(error + "(true & true)", SqlResult.Value, true);

      SqlResult = SqlFalse & SqlFalse2;
      AssertEquals(error + "(false & false)", SqlResult.Value, false);


    }

    // BitwixeOr operator
    public void TestBitwiseOrOperator() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      SqlBoolean SqlResult;
      String error = "BitwiseOr operator does not work correctly ";

      SqlResult = SqlTrue | SqlFalse;
      AssertEquals(error + "(true | false)", SqlResult.Value, true);
      SqlResult = SqlFalse | SqlTrue;

      AssertEquals(error + "(false | true)", SqlResult.Value, true);

      SqlResult = SqlTrue | SqlTrue2;
      AssertEquals(error + "(true | true)", SqlResult.Value, true);

      SqlResult = SqlFalse | SqlFalse2;
      AssertEquals(error + "(false | false)", SqlResult.Value, false);

    }

    // Equality operator
    public void TestEqualityOperator() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      SqlBoolean SqlResult;
      String error = "Equality operator does not work correctly ";

      SqlResult = SqlTrue == SqlFalse;
      AssertEquals(error + "(true == false)", SqlResult.Value, false);
      SqlResult = SqlFalse == SqlTrue;
      AssertEquals(error + "(false == true)", SqlResult.Value, false);

      SqlResult = SqlTrue == SqlTrue2;
      AssertEquals(error + "(true == true)", SqlResult.Value, true);

      SqlResult = SqlFalse == SqlFalse2;
      AssertEquals(error + "(false == false)", SqlResult.Value, true);

      SqlResult = SqlFalse == SqlBoolean.Null;
      AssertEquals(error + "(false == Null)", SqlResult.IsNull, true);
      SqlResult = SqlBoolean.Null == SqlBoolean.Null;
      AssertEquals(error + "(Null == true)", SqlResult.IsNull, true);

    }

    // ExlusiveOr operator
    public void TestExlusiveOrOperator() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      SqlBoolean SqlResult;
      String error = "ExclusiveOr operator does not work correctly ";

      SqlResult = SqlTrue ^ SqlFalse;
      AssertEquals(error + "(true ^ false)", SqlResult.Value, true);
      SqlResult = SqlFalse | SqlTrue;
      AssertEquals(error + "(false ^ true)", SqlResult.Value, true);

      SqlResult = SqlTrue ^ SqlTrue2;
      AssertEquals(error + "(true ^ true)", SqlResult.Value, false);

      SqlResult = SqlFalse ^ SqlFalse2;
      AssertEquals(error + "(false ^ false)", SqlResult.Value, false);

    }

    // false operator
    public void TestFalseOperator() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      String error = "false operator does not work correctly ";

      AssertEquals(error + "(true)", (!SqlTrue), SqlBoolean.False);
      AssertEquals(error + "(false)", (!SqlFalse), SqlBoolean.True);

    }

    // Inequality operator
    public void TestInequalityOperator() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlTrue2 = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);
      SqlBoolean SqlFalse2 = new SqlBoolean(false);

      String error = "Inequality operator does not work correctly" ;

      AssertEquals(error + "(true != true)",  SqlTrue != SqlTrue, SqlBoolean.False);
      AssertEquals(error + "(true != true)",  SqlTrue != SqlTrue2, SqlBoolean.False);
      AssertEquals(error + "(false != false)",  SqlFalse != SqlFalse, SqlBoolean.False);
      AssertEquals(error + "(false != false)",  SqlFalse != SqlFalse2, SqlBoolean.False);
      AssertEquals(error + "(true != false)",  SqlTrue != SqlFalse, SqlBoolean.True);
      AssertEquals(error + "(false != true)",  SqlFalse != SqlTrue, SqlBoolean.True);
      AssertEquals(error + "(null != true)",  SqlBoolean.Null != SqlTrue, SqlBoolean.Null);
      AssertEquals(error + "(false != null)",  SqlFalse != SqlBoolean.Null, SqlBoolean.Null);

    }

    // Logical Not operator
    public void TestLogicalNotOperator() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      String error = "Logical Not operator does not work correctly" ;

      AssertEquals(error + "(true)",  !SqlTrue, SqlBoolean.False);
      AssertEquals(error + "(false)",  !SqlFalse, SqlBoolean.True);

    }

    // OnesComplement operator
    public void TestOnesComplementOperator() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      String error = "Ones complement operator does not work correctly" ;

      SqlBoolean SqlResult;

      SqlResult = ~SqlTrue;
      AssertEquals(error + "(true)",  SqlResult.Value, false);
      SqlResult = ~SqlFalse;
      AssertEquals(error + "(false)", SqlResult.Value, true);

    }


    // true operator
    public void TestTrueOperator() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      String error = "true operator does not work correctly ";

      AssertEquals(error + "(true)", (SqlTrue), SqlBoolean.True);
      AssertEquals(error + "(false)", (SqlFalse), SqlBoolean.False);

    }

    // SqlBoolean to Boolean
    public void TestSqlBooleanToBoolean() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);
      String error = "SqlBooleanToBoolean operator does not work correctly ";

      Boolean TestBoolean = (Boolean)SqlTrue;
      AssertEquals(error + "(true)",  TestBoolean, SqlTrue.Value);
      TestBoolean = (Boolean)SqlFalse;
      AssertEquals(error + "(false)",  TestBoolean, SqlFalse.Value);

    }

    // SqlByte to SqlBoolean
    public void TestSqlByteToSqlBoolean() {

      SqlByte SqlTestByte;
      SqlBoolean SqlTestBoolean;
      String error = "SqlByteToSqlBoolean operator does not work correctly ";

      SqlTestByte = new SqlByte(1);
      SqlTestBoolean = (SqlBoolean)SqlTestByte;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTestByte = new SqlByte(2);
      SqlTestBoolean = (SqlBoolean)SqlTestByte;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTestByte = new SqlByte(0);
      SqlTestBoolean = (SqlBoolean)SqlTestByte;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);

    }

    // SqlDecimal to SqlBoolean
    public void TestSqlDecimalToSqlBoolean() {

      SqlDecimal SqlTest;
      SqlBoolean SqlTestBoolean;
      String error = "SqlDecimalToSqlBoolean operator does not work correctly ";

      SqlTest = new SqlDecimal(1);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlDecimal(19);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlDecimal(0);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);

    }

    // SqlDouble to SqlBoolean
    public void TestSqlDoubleToSqlBoolean() {

      SqlDouble SqlTest;
      SqlBoolean SqlTestBoolean;
      String error = "SqlDoubleToSqlBoolean operator does not work correctly ";

      SqlTest = new SqlDouble(1);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlDouble(19.8);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlDouble(0);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);

    }

    // SqlIn16 to SqlBoolean
    public void TestSqlInt16ToSqlBoolean() {

      SqlInt16 SqlTest;
      SqlBoolean SqlTestBoolean;
      String error = "SqlInt16ToSqlBoolean operator does not work correctly ";

      SqlTest = new SqlInt16(1);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlInt16(-143);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlInt16(0);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);

    }

    // SqlInt32 to SqlBoolean
    public void TestSqlInt32ToSqlBoolean() {

      SqlInt32 SqlTest;
      SqlBoolean SqlTestBoolean;
      String error = "SqlInt32ToSqlBoolean operator does not work correctly ";

      SqlTest = new SqlInt32(1);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlInt32(1430);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlInt32(0);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);
    }

    // SqlInt64 to SqlBoolean
    public void TestSqlInt64ToSqlBoolean() {

      SqlInt64 SqlTest;
      SqlBoolean SqlTestBoolean;
      String error = "SqlInt64ToSqlBoolean operator does not work correctly ";

      SqlTest = new SqlInt64(1);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlInt64(-14305);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlInt64(0);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);

    }

    // SqlMoney to SqlBoolean
    public void TestSqlMoneyToSqlBoolean() {

      SqlMoney SqlTest;
      SqlBoolean SqlTestBoolean;
      String error = "SqlMoneyToSqlBoolean operator does not work correctly ";

      SqlTest = new SqlMoney(1);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlMoney(1305);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlMoney(0);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);

    }

    // SqlSingle to SqlBoolean
    public void TestSqlSingleToSqlBoolean() {

      SqlSingle SqlTest;
      SqlBoolean SqlTestBoolean;
      String error = "SqlSingleToSqlBoolean operator does not work correctly ";

      SqlTest = new SqlSingle(1);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlSingle(1305);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlSingle(-305.3);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlSingle(0);
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);

    }

    // SqlString to SqlBoolean
    public void TestSqlStringToSqlBoolean() {

      SqlString SqlTest;
      SqlBoolean SqlTestBoolean;
      String error = "SqlSingleToSqlBoolean operator does not work correctly ";

      SqlTest = new SqlString("true");
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlString("TRUE");
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlString("True");
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = new SqlString("false");
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);

    }

    // Boolean to SqlBoolean
    public void BooleanToSqlBoolean() {

      SqlBoolean SqlTestBoolean;
      bool btrue = true;
      bool bfalse = false;
      String error = "BooleanToSqlBoolean operator does not work correctly ";

      Boolean SqlTest = true;
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);
      SqlTestBoolean = (SqlBoolean)btrue;
      AssertEquals(error + "(true)", SqlTestBoolean.Value, true);

      SqlTest = false;
      SqlTestBoolean = (SqlBoolean)SqlTest;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);
      SqlTestBoolean = (SqlBoolean)bfalse;
      AssertEquals(error + "(false)", SqlTestBoolean.Value, false);

    }

    // END OF OPERATORS
    ////

    ////
    // PROPERTIES

    // ByteValue property
    public void TestByteValueProperty() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      String error = "ByteValue property does not work correctly ";

      AssertEquals(error + "(true)", SqlTrue.ByteValue, (byte)1);
      AssertEquals(error + "(false)", SqlFalse.ByteValue, (byte)0);

    }

    // IsFalse property
    public void TestIsFalseProperty() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      String error = "IsFalse property does not work correctly ";

      AssertEquals(error + "(true)", SqlTrue.IsFalse, false);
      AssertEquals(error + "(false)", SqlFalse.IsFalse, true);

    }

    // IsNull property
    public void TestIsNullProperty() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      String error = "IsNull property does not work correctly ";

      AssertEquals(error + "(true)", SqlTrue.IsNull, false);
      AssertEquals(error + "(false)", SqlFalse.IsNull, false);

    }

    // IsTrue property
    public void TestIsTrueProperty() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      String error = "IsTrue property does not work correctly ";

      AssertEquals(error + "(true)", SqlTrue.IsTrue, true);
      AssertEquals(error + "(false)", SqlFalse.IsTrue, false);

    }

    // Value property
    public void TestValueProperty() {

      SqlBoolean SqlTrue = new SqlBoolean(true);
      SqlBoolean SqlFalse = new SqlBoolean(false);

      String error = "Value property does not work correctly ";

      AssertEquals(error + "(true)", SqlTrue.Value, true);
      AssertEquals(error + "(false)", SqlFalse.Value, false);

    }

    // END OF PROPERTIEs
    ////

    ////
    // FIELDS

    public void TestFalseField() {

      AssertEquals("False field does not work correctly",
        SqlBoolean.False.Value, false);

    }

    public void TestNullField() {

      AssertEquals("Null field does not work correctly",
        SqlBoolean.Null, SqlBoolean.Null);

    }

    public void TestOneField() {

      AssertEquals("One field does not work correctly",
        SqlBoolean.One.ByteValue, (byte)1);
    }


    public void TestTrueField() {

      AssertEquals("True field does not work correctly",
        SqlBoolean.True.Value, true);

    }

    public void TestZeroField() {

      AssertEquals("Zero field does not work correctly",
        SqlBoolean.Zero.ByteValue, (byte)0);

    }
  }
}


--------------Boundary-00=_JEH7Y5O20ND4L322XXKA--