Beispiel #1
0
        public void InsertNumberTest_WithParameters_15_15_0_0()
        {
            int expected = 15;
            int actual   = BitInserter.InsertNumber(15, 15, 0, 0);

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public void InsertNumberTest_WithParameters_78_86_1_4()
        {
            int expected = 76;
            int actual   = BitInserter.InsertNumber(78, 86, 1, 4);

            Assert.AreEqual(expected, actual);
        }
Beispiel #3
0
        public void InsertNumberTest_WithParameters_8_15_3_8()
        {
            int expected = 120;
            int actual   = BitInserter.InsertNumber(8, 15, 3, 8);

            Assert.AreEqual(expected, actual);
        }
        public void InsertNumber_WhereEndPositionIsInvalid_ArgumentOutOfRangeException()
        {
            int firstInt      = 8;
            int secondInt     = 15;
            int startPosition = 2;
            int endPosition   = 34;

            int actual = BitInserter.InsertNumber(firstInt, secondInt, startPosition, endPosition);
        }
        public void InsertNumber_WhereStartPositionBiggerThanEndPosition_ArgumentOutOfRangeException()
        {
            int firstInt      = 8;
            int secondInt     = 15;
            int startPosition = 3;
            int endPosition   = 2;

            int actual = BitInserter.InsertNumber(firstInt, secondInt, startPosition, endPosition);
        }
        public void InsertNumber_8And15BetweenIndex3and8_120expected()
        {
            int firstInt      = 8;
            int secondInt     = 15;
            int startPosition = 3;
            int endPosition   = 8;
            int expectedInt   = 120;

            int actual = BitInserter.InsertNumber(firstInt, secondInt, startPosition, endPosition);

            Assert.AreEqual(actual, expectedInt);
        }
 public void InsertNumberNTest_IndexMoreThan31()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(8, 15, 32, 0));
 }
 public void InsertNumberNTest_IndexIsNegative()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(8, 15, -1, 0));
 }
 public void InsertNumberNTest_FirstIndMoreThanSecondInd()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(8, 15, 2, 0));
 }
 public int InsertNumberNTest_WithParameters(int firstNum, int secondNum, int firstInd, int secondInd)
 => BitInserter.InsertNumber(firstNum, secondNum, firstInd, secondInd);
Beispiel #11
0
 public void InsertNumberTest_IndexMoreThan31()
 {
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(78, 86, 32, 4));
 }
Beispiel #12
0
 public void InsertNumberTest_FirstIndMoreThanSecondInd()
 {
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(78, 86, 4, 1));
 }
Beispiel #13
0
 public void InsertNumberTest_IndexIsNegative()
 {
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(78, 86, -1, 4));
 }
Beispiel #14
0
        public int CheckNumberInsertion(int numberSource, int numberIn, int i, int j)
        {
            var bitInserter = new BitInserter();

            return(bitInserter.InsertNumber(numberSource, numberIn, i, j));
        }