Example #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.");
        }
Example #2
0
        public void EqualingToDifferentObjectType_ShouldReturnFalse()
        {
            Hex32        hexValue    = new Hex32(10);
            const string StringValue = "10";

            Assert.IsFalse(hexValue.Equals(StringValue), "Expected false.");
        }
Example #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.");
        }
Example #4
0
        public void EqualingTwoSameHex_ShouldReturnTrue()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(10);

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

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

            Assert.IsTrue(hexValue2 < hexValue, "Expected true.");
        }
Example #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.");
        }
Example #8
0
        public void MultiplyTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(50, (hexValue * hexValue2).IntValue, "Expected 50.");
        }
Example #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");
        }
Example #10
0
        public void AddTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue  = new Hex32(5);
            Hex32 hexValue2 = new Hex32(5);

            Assert.AreEqual(10, (hexValue + hexValue2).IntValue);
        }
Example #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");
        }
Example #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");
        }
Example #13
0
        public void DivideTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue  = new Hex32(10);
            Hex32 hexValue2 = new Hex32(5);

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

            Assert.IsFalse(hexValue.Equals(hexValue2), "Expected false.");
        }
Example #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");
        }
Example #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");
        }
Example #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");
        }
Example #18
0
        public void AddTwoHex_ShouldReturnCorrectValue()
        {
            Hex32 hexValue = new Hex32(5);
            Hex32 hexValue2 = new Hex32(5);

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

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

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

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

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

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

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

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

            Assert.IsTrue(hexValue == hexValue2, "hexValue == hexValue2");
        }
Example #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.");
        }
Example #28
0
        public void EqualingTheSameHex_ShouldReturnTrue()
        {
            Hex32 hexValue = new Hex32(20);
            Hex32 hexValue2 = new Hex32(20);

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

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

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

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

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

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

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