コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 public void InsertNumberNTest_IndexMoreThan31()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(8, 15, 32, 0));
 }
コード例 #8
0
 public void InsertNumberNTest_IndexIsNegative()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(8, 15, -1, 0));
 }
コード例 #9
0
 public void InsertNumberNTest_FirstIndMoreThanSecondInd()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(8, 15, 2, 0));
 }
コード例 #10
0
 public int InsertNumberNTest_WithParameters(int firstNum, int secondNum, int firstInd, int secondInd)
 => BitInserter.InsertNumber(firstNum, secondNum, firstInd, secondInd);
コード例 #11
0
 public void InsertNumberTest_IndexMoreThan31()
 {
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(78, 86, 32, 4));
 }
コード例 #12
0
 public void InsertNumberTest_FirstIndMoreThanSecondInd()
 {
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(78, 86, 4, 1));
 }
コード例 #13
0
 public void InsertNumberTest_IndexIsNegative()
 {
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => BitInserter.InsertNumber(78, 86, -1, 4));
 }
コード例 #14
0
        public int CheckNumberInsertion(int numberSource, int numberIn, int i, int j)
        {
            var bitInserter = new BitInserter();

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