Exemplo n.º 1
0
        public void ConvertHex32ToInt_ShouldGiveCorrectIntValue()
        {
            const int value = 32;
            Hex32 testHex = new Hex32(value);

            Assert.AreEqual(value, testHex.IntValue, "Should return correct integer value.");
        }
Exemplo n.º 2
0
        public void EqualingToDifferentObjectType_ShouldReturnFalse()
        {
            Hex32        hexValue    = new Hex32(10);
            const string StringValue = "10";

            Assert.IsFalse(hexValue.Equals(StringValue), "Expected false.");
        }
Exemplo n.º 3
0
        public void ConvertHex32ToInt_ShouldGiveCorrectIntValue()
        {
            const int value   = 32;
            Hex32     testHex = new Hex32(value);

            Assert.AreEqual(value, testHex.IntValue, "Should return correct integer value.");
        }
Exemplo n.º 4
0
        public void EqualingTwoSameHex_ShouldReturnTrue()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(10);

            Assert.IsTrue(hexValue == hexValue2, "hexValue == hexValue2");
        }
Exemplo n.º 5
0
        public void NotEqualingTwoSameHex_ShouldReturnFalse()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(10);

            Assert.IsFalse(hexValue != hexValue2, "hexValue != hexValue2");
        }
Exemplo n.º 6
0
        public void SmallerThanTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

            Assert.IsTrue(hexValue2 < hexValue, "Expected true.");
        }
Exemplo n.º 7
0
        public void HexHashCode_ShouldBeEqualToSameHexNumberHashCode()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(10);

            Assert.AreEqual(hexValue.GetHashCode(), hexValue2.GetHashCode(), "Expected Equal hashcodes.");
        }
Exemplo n.º 8
0
        public void MultiplyTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(50, (hexValue * hexValue2).IntValue, "Expected 50.");
        }
Exemplo n.º 9
0
        public void CompareHexToEqual_ShouldReturnZero()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(10);

            Assert.IsTrue(hexValue.CompareTo(hexValue2) == 0, "hexValue.CompareTo(hexValue2) == 0");
        }
Exemplo n.º 10
0
        public void AddTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue  = new Hex32(5);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(10, (hexValue + hexValue2).IntValue);
        }
Exemplo n.º 11
0
        public void CompareHexToSmaller_ShouldReturnMoreThanZero()
        {
            Hex32 hexValue  = new Hex32(20);
            Hex32 hexValue2 = new Hex32(10);

            Assert.IsTrue(hexValue.CompareTo(hexValue2) > 0, "hexValue.CompareTo(hexValue2) > 0");
        }
Exemplo n.º 12
0
        public void CompareHexToBigger_ShouldReturnLessThanZero()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(20);

            Assert.IsTrue(hexValue.CompareTo(hexValue2) < 0, "hexValue.CompareTo(hexValue2) < 0");
        }
Exemplo n.º 13
0
        public void DivideTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(2, (hexValue / hexValue2).IntValue, "Expected 2.");
        }
Exemplo n.º 14
0
        public void EqualingDifferentHex_ShouldReturnFalse()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(20);

            Assert.IsFalse(hexValue.Equals(hexValue2), "Expected false.");
        }
Exemplo n.º 15
0
        public void CompareHexToEqual_ShouldReturnZero()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(10);

            Assert.IsTrue(hexValue.CompareTo(hexValue2) == 0, "hexValue.CompareTo(hexValue2) == 0");
        }
Exemplo n.º 16
0
        public void CompareHexToSmaller_ShouldReturnMoreThanZero()
        {
            Hex32 hexValue = new Hex32(20);
            Hex32 hexValue2 = new Hex32(10);

            Assert.IsTrue(hexValue.CompareTo(hexValue2) > 0, "hexValue.CompareTo(hexValue2) > 0");
        }
Exemplo n.º 17
0
        public void CompareHexToBigger_ShouldReturnLessThanZero()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(20);

            Assert.IsTrue(hexValue.CompareTo(hexValue2) < 0, "hexValue.CompareTo(hexValue2) < 0");
        }
Exemplo n.º 18
0
        public void AddTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue = new Hex32(5);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(10, (hexValue + hexValue2).IntValue);
        }
Exemplo n.º 19
0
        public void SubtractTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(5, (hexValue - hexValue2).IntValue);
        }
Exemplo n.º 20
0
        public void EqualingTheSameHex_ShouldReturnTrue()
        {
            Hex32 hexValue  = new Hex32(20);
            Hex32 hexValue2 = new Hex32(20);

            Assert.IsTrue(hexValue.Equals(hexValue2), "Expected true.");
        }
Exemplo n.º 21
0
        public void DivideTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(2, (hexValue / hexValue2).IntValue, "Expected 2.");
        }
Exemplo n.º 22
0
        public void SmallerThanTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

            Assert.IsTrue(hexValue2 < hexValue, "Expected true.");
        }
Exemplo n.º 23
0
        public void SubtractTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(5, (hexValue - hexValue2).IntValue);
        }
Exemplo n.º 24
0
        public void MultiplyTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(50, (hexValue * hexValue2).IntValue, "Expected 50.");
        }
Exemplo n.º 25
0
        public void NotEqualingTwoSameHex_ShouldReturnFalse()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(10);

            Assert.IsFalse(hexValue != hexValue2, "hexValue != hexValue2");
        }
Exemplo n.º 26
0
        public void EqualingTwoSameHex_ShouldReturnTrue()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(10);

            Assert.IsTrue(hexValue == hexValue2, "hexValue == hexValue2");
        }
Exemplo n.º 27
0
        public void HexHashCode_ShouldBeEqualToSameHexNumberHashCode()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(10);

            Assert.AreEqual(hexValue.GetHashCode(), hexValue2.GetHashCode(), "Expected Equal hashcodes.");
        }
Exemplo n.º 28
0
        public void EqualingTheSameHex_ShouldReturnTrue()
        {
            Hex32 hexValue = new Hex32(20);
            Hex32 hexValue2 = new Hex32(20);

            Assert.IsTrue(hexValue.Equals(hexValue2), "Expected true.");
        }
Exemplo n.º 29
0
        public void EqualingToDifferentObjectType_ShouldReturnFalse()
        {
            Hex32 hexValue = new Hex32(10);
            const string StringValue = "10";

            Assert.IsFalse(hexValue.Equals(StringValue), "Expected false.");
        }
Exemplo n.º 30
0
        public string CreateHex32WithValidIntValue_ShouldGiveCorrectHexValue(int value)
        {
            Hex32 hex = new Hex32(value);

            return(hex.ToString());
        }
Exemplo n.º 31
0
        public void EqualingDifferentHex_ShouldReturnFalse()
        {
            Hex32 hexValue = new Hex32(10);
            Hex32 hexValue2 = new Hex32(20);

            Assert.IsFalse(hexValue.Equals(hexValue2), "Expected false.");
        }
Exemplo n.º 32
0
        public void ImplicitlyCreatingHex_ShouldReturnCorrectHex()
        {
            Hex32 test = 5;

            Assert.AreEqual(5, test.IntValue, "Expected true.");
        }
Exemplo n.º 33
0
        public static string ToHexString(this int value)
        {
            Hex32 rtn = value;

            return(rtn.ToString());
        }
Exemplo n.º 34
0
        public static int FromHexString(this string value)
        {
            Hex32 rtn = value;

            return(rtn);
        }
Exemplo n.º 35
0
 public string CreateHex32WithValidIntValue_ShouldGiveCorrectHexValue(int value)
 {
     Hex32 hex = new Hex32(value);
     return hex.ToString();
 }