Esempio n. 1
0
 public static IPv4 CreateIPv4(SqlByte i1, SqlByte i2, SqlByte i3, SqlByte i4)
 {
     IPv4 ip = new IPv4(i1.Value, i2.Value, i3.Value, i4.Value);
     if (ip == null)
         return IPv4.Null;
     else
         return ip;
 }
Esempio n. 2
0
        public void Properties()
        {
            SqlByte TestByte = new SqlByte(54);
            SqlByte TestByte2 = new SqlByte(1);

            Assert.True(SqlByte.Null.IsNull);
            Assert.Equal((byte)54, TestByte.Value);
            Assert.Equal((byte)1, TestByte2.Value);
        }
		public void Properties()
		{

			SqlByte TestByte = new SqlByte(54);
			SqlByte TestByte2 = new SqlByte(1);

			Assert("IsNull property" + Error, SqlByte.Null.IsNull);
			AssertEquals("Value property 1" + Error, (byte)54, TestByte.Value);
			AssertEquals("Value property 2" + Error, (byte)1, TestByte2.Value);

		}
Esempio n. 4
0
		public void Properties()
		{

			SqlByte TestByte = new SqlByte(54);
			SqlByte TestByte2 = new SqlByte(1);

			Assert.IsTrue (SqlByte.Null.IsNull, "IsNull property" + Error);
			Assert.AreEqual((byte)54, TestByte.Value, "Value property 1" + Error);
			Assert.AreEqual((byte)1, TestByte2.Value, "Value property 2" + Error);

		}
Esempio n. 5
0
    public static SqlMoney Account_AccountBalances_GetRelativeBalance(SqlByte b1)
    {
        switch ((int) b1)
          {
               case 1:

               case 2:

               case 3:

               case 4:

               case 5:
                    break;
          }
          // Put your code here
          return new SqlMoney(0m);
    }
Esempio n. 6
0
        public void AddMethod()
        {
            SqlByte TestByte64 = new SqlByte(64);
            SqlByte TestByte0 = new SqlByte(0);
            SqlByte TestByte164 = new SqlByte(164);
            SqlByte TestByte255 = new SqlByte(255);

            Assert.Equal((byte)64, SqlByte.Add(TestByte64, TestByte0).Value);
            Assert.Equal((byte)228, SqlByte.Add(TestByte64, TestByte164).Value);
            Assert.Equal((byte)164, SqlByte.Add(TestByte0, TestByte164).Value);
            Assert.Equal((byte)255, SqlByte.Add(TestByte255, TestByte0).Value);

            try
            {
                SqlByte.Add(TestByte255, TestByte64);
                Assert.False(true);
            }
            catch (Exception e)
            {
                Assert.Equal(typeof(OverflowException), e.GetType());
            }
        }
Esempio n. 7
0
		public void BitwiseOrOperator()
		{

			SqlByte TestByte2 = new SqlByte(2);
			SqlByte TestByte4 = new SqlByte(4);
			SqlByte TestByte255 = new SqlByte(255);

			Assert.AreEqual((SqlByte)6,TestByte2 | TestByte4, "Bitwise or operator 1" + Error);
			Assert.AreEqual((SqlByte)255, TestByte2 | TestByte255, "Bitwise or operaror 2" + Error);
		}
Esempio n. 8
0
		public void EqualityOperator()
		{

			SqlByte TestByte15 = new SqlByte(15);
			SqlByte TestByte15II = new SqlByte(15);
			SqlByte TestByte255 = new SqlByte(255);

			Assert.IsTrue ((TestByte15 == TestByte15II).Value, "== operator" + Error);
			Assert.IsTrue (!(TestByte15 == TestByte255).Value, "== operator 2" + Error);
			Assert.IsTrue (!(TestByte15 != TestByte15II).Value, "!= operator" + Error);
			Assert.IsTrue ((TestByte15 != TestByte255).Value, "!= operator 2" + Error);

		}
Esempio n. 9
0
		public void TestXor()
		{

			SqlByte TestByte14 = new SqlByte(14);
			SqlByte TestByte58 = new SqlByte(58);
			SqlByte TestByte130 = new SqlByte(130);

			Assert.AreEqual((byte)52, SqlByte.Xor(TestByte14, TestByte58).Value, "Xor method 1" + Error);
			Assert.AreEqual((byte)140, SqlByte.Xor(TestByte14, TestByte130).Value, "Xor method 2" + Error);
			Assert.AreEqual((byte)184, SqlByte.Xor(TestByte58, TestByte130).Value, "Xor method 3" + Error);

		}
Esempio n. 10
0
		public void AdditionOperator()
		{

			SqlByte TestByte24 = new SqlByte(24);
			SqlByte TestByte64 = new SqlByte(64);
			SqlByte TestByte255 = new SqlByte(255);

			Assert.AreEqual((SqlByte)88,TestByte24 + TestByte64, "Addition operator" + Error);

			try {
				SqlByte result = TestByte64 + TestByte255;
				Assert.Fail("Addition operator 1" + Error);
			} catch (Exception e) {
				Assert.AreEqual(typeof(OverflowException), e.GetType(), "Addition operator 2" + Error);
			}
			
		}
Esempio n. 11
0
		public void ToSqlInt64()
		{
			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte0 = new SqlByte(0);
			SqlByte TestByte228 = new SqlByte(228);

			Assert.AreEqual((long)12, TestByte12.ToSqlInt64().Value, "ToSqInt64 method " + Error);
			Assert.AreEqual((long)0, TestByte0.ToSqlInt64().Value, "ToSqlInt64 method 2" + Error);
			Assert.AreEqual((long)228, TestByte228.ToSqlInt64().Value, "ToSqlInt64 method 3" + Error);

		}
Esempio n. 12
0
		public void ToSqlSingle()
		{
	    
			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte0 = new SqlByte(0);
			SqlByte TestByte228 = new SqlByte(228);

			Assert.AreEqual((float)12, TestByte12.ToSqlSingle().Value, "ToSqlSingle method 1" + Error);
			Assert.AreEqual((float)0, TestByte0.ToSqlSingle().Value, "ToSqlSingle method 2" + Error);
			Assert.AreEqual((float)228, TestByte228.ToSqlSingle().Value, "ToSqlSingle method 3" + Error);

		}
Esempio n. 13
0
 // Alternative method for operator ==
 public static SqlBoolean Equals(SqlByte x, SqlByte y)
 {
     return(x == y);
 }
Esempio n. 14
0
		public void ToSqlDecimal()
		{
			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte0 = new SqlByte(0);
			SqlByte TestByte228 = new SqlByte(228);

			Assert.AreEqual((decimal)12, TestByte12.ToSqlDecimal().Value, "ToSqlDecimal method 1" + Error);
			Assert.AreEqual((decimal)0, TestByte0.ToSqlDecimal().Value, "ToSqlDecimal method 2" + Error);
			Assert.AreEqual((decimal)228, TestByte228.ToSqlDecimal().Value, "ToSqlDecimal method 3" + Error);
			
		}
Esempio n. 15
0
 // Alternative method for operator |
 public static SqlByte BitwiseOr(SqlByte x, SqlByte y)
 {
     return(x | y);
 }
Esempio n. 16
0
 // Alternative method for operator ^
 public static SqlByte Xor(SqlByte x, SqlByte y)
 {
     return(x ^ y);
 }
Esempio n. 17
0
 // Alternative method for operator &
 public static SqlByte BitwiseAnd(SqlByte x, SqlByte y)
 {
     return(x & y);
 }
Esempio n. 18
0
 public static SqlByte Modulus(SqlByte x, SqlByte y)
 {
     return(x % y);
 }
Esempio n. 19
0
 // Alternative method for operator /
 public static SqlByte Divide(SqlByte x, SqlByte y)
 {
     return(x / y);
 }
Esempio n. 20
0
		public void ThanOrEqualOperators()
		{

			SqlByte TestByte165 = new SqlByte(165);
			SqlByte TestByte100 = new SqlByte(100);
			SqlByte TestByte100II = new SqlByte(100);
			SqlByte TestByte255 = new SqlByte(255);

			Assert.IsTrue ((TestByte165 > TestByte100).Value, "> operator 1" + Error);
			Assert.IsTrue (!(TestByte165 > TestByte255).Value, "> operator 2" + Error);
			Assert.IsTrue (!(TestByte100 > TestByte100II).Value, "> operator 3" + Error);
			Assert.IsTrue (!(TestByte165 >= TestByte255).Value, ">= operator 1" + Error);
			Assert.IsTrue ((TestByte255 >= TestByte165).Value, ">= operator 2" + Error);
			Assert.IsTrue ((TestByte100 >= TestByte100II).Value, ">= operator 3" + Error);

			Assert.IsTrue (!(TestByte165 < TestByte100).Value, "< operator 1" + Error);
			Assert.IsTrue ((TestByte165 < TestByte255).Value, "< operator 2" + Error);
			Assert.IsTrue (!(TestByte100 < TestByte100II).Value, "< operator 3" + Error);
			Assert.IsTrue ((TestByte165 <= TestByte255).Value, "<= operator 1" + Error);
			Assert.IsTrue (!(TestByte255 <= TestByte165).Value, "<= operator 2" + Error);
			Assert.IsTrue ((TestByte100 <= TestByte100II).Value, "<= operator 3" + Error);
		}
Esempio n. 21
0
 // Alternative method for operator !=
 public static SqlBoolean NotEquals(SqlByte x, SqlByte y)
 {
     return(x != y);
 }
Esempio n. 22
0
 // Alternative method for operator *
 public static SqlByte Multiply(SqlByte x, SqlByte y)
 {
     return(x * y);
 }
Esempio n. 23
0
 // Alternative method for operator +
 public static SqlByte Add(SqlByte x, SqlByte y)
 {
     return(x + y);
 }
Esempio n. 24
0
		public void ToSqlInt32()
		{

			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte0 = new SqlByte(0);
			SqlByte TestByte228 = new SqlByte(228);
			
			Assert.AreEqual((int)12, TestByte12.ToSqlInt32().Value, "ToSqInt32 method 1" + Error);
			Assert.AreEqual((int)0, TestByte0.ToSqlInt32().Value, "ToSqlInt32 method 2" + Error);
			Assert.AreEqual((int)228, TestByte228.ToSqlInt32().Value, "ToSqlInt32 method 3" + Error);

		}
Esempio n. 25
0
        //--------------------------------------------------
        // Alternative methods for overloaded operators
        //--------------------------------------------------

        // Alternative method for operator ~
        public static SqlByte OnesComplement(SqlByte x)
        {
            return(~x);
        }
Esempio n. 26
0
		public void ToSqlMoney()
		{

			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte0 = new SqlByte(0);
			SqlByte TestByte228 = new SqlByte(228);

			Assert.AreEqual(12.0000M, TestByte12.ToSqlMoney().Value, "ToSqMoney method 1" + Error);
			Assert.AreEqual((decimal)0, TestByte0.ToSqlMoney().Value, "ToSqlMoney method 2" + Error);
			Assert.AreEqual(228.0000M, TestByte228.ToSqlMoney().Value, "ToSqlMoney method 3" + Error);
		}
Esempio n. 27
0
 // Alternative method for operator >=
 public static SqlBoolean GreaterThanOrEqual(SqlByte x, SqlByte y)
 {
     return(x >= y);
 }
Esempio n. 28
0
		public void ToStringTest()
		{

			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte0 = new SqlByte(0);
			SqlByte TestByte228 = new SqlByte(228);
			
			Assert.AreEqual("12", TestByte12.ToString(), "ToString method 1" + Error);
			Assert.AreEqual("0", TestByte0.ToString(), "ToString method 2" + Error);
			Assert.AreEqual("228", TestByte228.ToString(), "ToString method 3" + Error);
		}
Esempio n. 29
0
 // Alternative method for operator <=
 public static SqlBoolean LessThanOrEqual(SqlByte x, SqlByte y)
 {
     return(x <= y);
 }
Esempio n. 30
0
		public void Create()
		{
			byte b = 29;
			SqlByte TestByte = new SqlByte(b);
			Assert.AreEqual((byte)29, TestByte.Value, "Constructor 1 does not work correctly");
		}
Esempio n. 31
0
		public void OnesComplementOperator()
		{

			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte128 = new SqlByte(128);

			Assert.AreEqual((SqlByte)243, ~TestByte12, "OnesComplement operator 1" + Error);
			Assert.AreEqual((SqlByte)127, ~TestByte128, "OnesComplement operator 2" + Error);

		}
Esempio n. 32
0
		public void BitwiseAndOperator()
		{

			SqlByte TestByte2 = new SqlByte(2);
			SqlByte TestByte4 = new SqlByte(4);
			SqlByte TestByte255 = new SqlByte(255);

			Assert.AreEqual((SqlByte)0,TestByte2 & TestByte4, "Bitwise and operator 1" + Error);
			Assert.AreEqual((SqlByte)2, TestByte2 & TestByte255, "Bitwise and operaror 2" + Error);
		}
Esempio n. 33
0
		public void SqlByteToByte()
		{
			SqlByte TestByte = new SqlByte(12);
			byte test = (byte)TestByte;
			Assert.AreEqual((byte)12, test, "SqlByteToByte" + Error);
		}
Esempio n. 34
0
		public void DivisionOperator()
		{

			SqlByte TestByte2 = new SqlByte(2);
			SqlByte TestByte4 = new SqlByte(4);
			SqlByte TestByte255 = new SqlByte(255);
			SqlByte TestByte0 = new SqlByte(0);

			Assert.AreEqual((SqlByte)2,TestByte4 / TestByte2, "Division operator 1" + Error);
			Assert.AreEqual((SqlByte)127, TestByte255 / TestByte2, "Division operaror 2" + Error);

			try {
				TestByte2 = TestByte255 / TestByte0;
				Assert.Fail("Division operator 3" + Error);
			} catch (Exception e) {
				Assert.AreEqual(typeof(DivideByZeroException), e.GetType(), "DivideByZeroException");
			}

		}
Esempio n. 35
0
		public void AddMethod()
		{

			SqlByte TestByte64 = new SqlByte(64);
			SqlByte TestByte0 = new SqlByte(0);
			SqlByte TestByte164 = new SqlByte(164);
			SqlByte TestByte255 = new SqlByte(255);

			Assert.AreEqual((byte)64, SqlByte.Add(TestByte64, TestByte0).Value, "AddMethod 1" + Error);
			Assert.AreEqual((byte)228, SqlByte.Add(TestByte64, TestByte164).Value, "AddMethod 2" + Error);
			Assert.AreEqual((byte)164, SqlByte.Add(TestByte0, TestByte164).Value, "AddMethod 3" + Error);
			Assert.AreEqual((byte)255, SqlByte.Add(TestByte255, TestByte0).Value, "AddMethod 4" + Error);

			try {
				SqlByte.Add(TestByte255, TestByte64);
				Assert.Fail ("AddMethod 6" + Error);
			} catch (Exception e) {
				Assert.AreEqual(typeof(OverflowException), e.GetType(), "AddMethod 5" + Error);
			}

		}
Esempio n. 36
0
		public void ExclusiveOrOperator()
		{

			SqlByte TestByte15 = new SqlByte(15);
			SqlByte TestByte10 = new SqlByte(10);
			SqlByte TestByte255 = new SqlByte(255);

			Assert.AreEqual((SqlByte)5, (TestByte15 ^ TestByte10), "Exclusive or operator 1" + Error);
			Assert.AreEqual((SqlByte)240, (TestByte15 ^ TestByte255), "Exclusive or operator 2" + Error);
		}
Esempio n. 37
0
 // Alternative method for operator >
 public static SqlBoolean GreaterThan(SqlByte x, SqlByte y)
 {
     return(x > y);
 }
Esempio n. 38
0
		public void MultiplicationOperator()
		{

			SqlByte TestByte4 = new SqlByte(4);
			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte128 = new SqlByte(128);

			Assert.AreEqual((SqlByte)48, TestByte4 * TestByte12, "Multiplication operator 1" + Error);
			try {
				SqlByte test = (TestByte128 * TestByte4);
				Assert.Fail("Multiplication operator 2" + Error);
			} catch (Exception e) {
				Assert.AreEqual(typeof(OverflowException), e.GetType(), "OverflowException");
			}

		}
Esempio n. 39
0
 // Alternative method for operator -
 public static SqlByte Subtract(SqlByte x, SqlByte y)
 {
     return(x - y);
 }
Esempio n. 40
0
		public void SubtractionOperator()
		{

			SqlByte TestByte4 = new SqlByte(4);
			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte128 = new SqlByte(128);

			Assert.AreEqual((SqlByte)8, TestByte12 - TestByte4, "Subtraction operator 1" + Error);
			try {
				
				SqlByte test = TestByte4 - TestByte128;
				Assert.Fail("Sybtraction operator 2" + Error);

			} catch (Exception e) {

				Assert.AreEqual(typeof(OverflowException), e.GetType(), "OverflowException");
			}

		}
Esempio n. 41
0
		public void OnesComplement()
		{

			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte128 = new SqlByte(128);

			Assert.AreEqual((SqlByte)243, SqlByte.OnesComplement(TestByte12), "OnesComplement method 1" + Error);
			Assert.AreEqual((SqlByte)127, SqlByte.OnesComplement(TestByte128), "OnesComplement method 2" + Error);

		}
Esempio n. 42
0
		public void Subtract()
		{

			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte128 = new SqlByte(128);
			Assert.AreEqual((byte)116, SqlByte.Subtract(TestByte128, TestByte12).Value, "Subtract method 1" + Error);

			try {
				SqlByte.Subtract(TestByte12, TestByte128);
			} catch(Exception e) {

				Assert.AreEqual(typeof(OverflowException), e.GetType(), "OverflowException");
			}

		}
Esempio n. 43
0
		public void ToSqlBoolean()
		{

			SqlByte TestByte12 = new SqlByte(12);
			SqlByte TestByte0 = new SqlByte(0);
			SqlByte TestByteNull = SqlByte.Null;

			Assert.IsTrue (TestByte12.ToSqlBoolean().Value, "ToSqlBoolean method 1" + Error);
			Assert.IsTrue (!TestByte0.ToSqlBoolean().Value, "ToSqlBoolean method 2" + Error);
			Assert.IsTrue (TestByteNull.ToSqlBoolean().IsNull, "ToSqlBoolean method 3" + Error);
		}
Esempio n. 44
0
 public SqlByte Adjust(SqlByte value)
 {
     if (SqlDbType.TinyInt != SqlDbType)
         ThrowInvalidType();
     return value;
 }
Esempio n. 45
0
 // Alternative method for operator <
 public static SqlBoolean LessThan(SqlByte x, SqlByte y)
 {
     return(x < y);
 }