本文整理汇总了C#中System.Data.SqlTypes.SqlByte类的典型用法代码示例。如果您正苦于以下问题:C# SqlByte类的具体用法?C# SqlByte怎么用?C# SqlByte使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlByte类属于System.Data.SqlTypes命名空间,在下文中一共展示了SqlByte类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateIPv4
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;
}
示例2: Properties
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);
}
示例3: Properties
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);
}
示例4: Properties
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);
}
示例5: Account_AccountBalances_GetRelativeBalance
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);
}
示例6: AddMethod
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());
}
}
示例7: DivisionOperator
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");
}
}
示例8: BitwiseOrOperator
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);
}
示例9: BitwiseAndOperator
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);
}
示例10: Subtract
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");
}
}
示例11: SqlByteToByte
public void SqlByteToByte()
{
SqlByte TestByte = new SqlByte(12);
byte test = (byte)TestByte;
Assert.AreEqual((byte)12, test, "SqlByteToByte" + Error);
}
示例12: OnesComplementOperator
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);
}
示例13: ThanOrEqualOperators
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);
}
示例14: ToSqlSingle
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);
}
示例15: ToSqlMoney
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);
}