public void InsertNumberTest()
        {
            int expected = 345346;

            int result = NumbersExtension.InsertNumberIntoAnother(-55465467, 345346, 0, 31);

            Assert.AreEqual(expected, result);
        }
        public void InsertNumberIntoAnotherWith14_50_Return_22()
        {
            int sourceNumber = 14;
            int numberln     = 50;
            int i            = 3;
            int j            = 6;
            int expected     = 22;
            int actual       = NumbersExtension.InsertNumberIntoAnother(sourceNumber, numberln, i, j);

            Assert.AreEqual(expected, actual);
        }
        public void InsertNumberIntoAnotherWithBigNumbers()
        {
            int sourceNumber = 554216104;
            int numberln     = 4460559;
            int i            = 11;
            int j            = 18;
            int expected     = 554203816;
            int actual       = NumbersExtension.InsertNumberIntoAnother(sourceNumber, numberln, i, j);

            Assert.AreEqual(expected, actual);
        }
        public void InsertNumberIntoAnotherTest_TestData_ExpectedNumber()
        {
            int numberSource = Convert.ToInt32(TestContext.DataRow["numberSource"]);
            int numberIn     = Convert.ToInt32(TestContext.DataRow["numberIn"]);
            int i            = Convert.ToInt32(TestContext.DataRow["i"]);
            int j            = Convert.ToInt32(TestContext.DataRow["j"]);
            int expected     = Convert.ToInt32(TestContext.DataRow["expectedNumber"]);

            var actual = NumbersExtension.InsertNumberIntoAnother(numberSource, numberIn, i, j);

            Assert.AreEqual(actual, expected);
        }
示例#5
0
 public void InsertNumberIntoAnother_IOrJLessThan0_ArgumentOutOfRangeException()
 {
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => NumbersExtension.InsertNumberIntoAnother(8, 15, -1, 3));
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => NumbersExtension.InsertNumberIntoAnother(8, 15, 32, 32));
     Assert.ThrowsException <ArgumentOutOfRangeException>(() => NumbersExtension.InsertNumberIntoAnother(8, 15, 0, 32));
 }
示例#6
0
 public void InsertNumberIntoAnother_ILargerThanJ_ArgumentException()
 {
     Assert.ThrowsException <ArgumentException>(() => NumbersExtension.InsertNumberIntoAnother(8, 15, 8, 3));
 }
示例#7
0
 public int InsertNumberIntoAnotherTest(int numberSource, int numberIn, int i, int j, int expected)
 {
     return(NumbersExtension.InsertNumberIntoAnother(numberSource, numberIn, i, j));
 }
 public void SInsertNumberIntoAnother_Throw_ArgumentException()
 {
     Assert.ThrowsException <ArgumentException>(() => NumbersExtension.InsertNumberIntoAnother(10, 45, 23, 12),
                                                message: "Method generates ArgumentException in case i more then j");
 }
示例#9
0
 public void InsertNumberIntoAnother_ArgumentOutOfRangeException_MoreAndLess() =>
 Assert.Throws <ArgumentOutOfRangeException>(() => NumbersExtension.InsertNumberIntoAnother(8, 15, 0, 32),
                                             message: "index must be less then 32");
示例#10
0
 public void InsertNumberIntoAnother_ArgumentOutOfRangeException_Less() =>
 Assert.Throws <ArgumentOutOfRangeException>(() => NumbersExtension.InsertNumberIntoAnother(8, 15, -1, 3),
                                             message: "index must be positive");
示例#11
0
 public void InsertNumberIntoAnother_ArgumentException() =>
 Assert.Throws <ArgumentException>(() => NumbersExtension.InsertNumberIntoAnother(8, 15, 8, 3),
                                   message: "i must be less then j");
示例#12
0
 public int InsertNumbers_SomeNumbers_ExpectedResult(int numberSource, int numberIn, int i, int j)
 {
     return(NumbersExtension.InsertNumberIntoAnother(numberSource, numberIn, i, j));
 }