コード例 #1
0
        public void TestMethod6()
        {
            MethodLibrary.MethodLibrary obj = new MethodLibrary.MethodLibrary();

            string Expected = "Có 2 nghiệm phân biệt";
            string Actual   = obj.SolveQuadratic(1, -4, 3, out float x1, out float x2);

            Assert.AreEqual(Expected, Actual);
        }
コード例 #2
0
        public void TestMethod1()
        {
            MethodLibrary.MethodLibrary obj = new MethodLibrary.MethodLibrary();

            string Expected = "Vô số nghiệm";
            string Actual   = obj.SolveQuadratic(0, 0, 0, out float x1, out float x2);

            Assert.AreEqual(Expected, Actual);
        }
コード例 #3
0
        public void TestCaseHuyChuoi_09()
        {
            MethodLibrary.MethodLibrary obj = new MethodLibrary.MethodLibrary();

            string Expected = "abcdefhg";
            string Actual   = obj.HuyChuoi("abcdefhg", 4, 8);

            Assert.AreEqual(Expected, Actual);
        }
コード例 #4
0
        public void TestMethod5()
        {
            MethodLibrary.MethodLibrary obj = new MethodLibrary.MethodLibrary();

            string Expected = "Có nghiệm kép";
            string Actual   = obj.SolveQuadratic(2, 4, 2, out float x1, out float x2);

            Assert.AreEqual(Expected, Actual);
        }
コード例 #5
0
        public void TestMethodSUMDataDriven()
        {
            MethodLibrary.MethodLibrary oj = new MethodLibrary.MethodLibrary();

            long Expected = Convert.ToInt64(TestContext.DataRow[1]);
            long Actual   = oj.Sum(Convert.ToInt64(TestContext.DataRow[0]), out long s1);

            Assert.AreEqual(Expected, Actual);
        }
コード例 #6
0
        public void TestLargest_02()
        {
            MethodLibrary.MethodLibrary obj = new MethodLibrary.MethodLibrary();

            int[] a = { 4, 3, 6 };
            int   expectedResult = 6;
            int   actualResult   = obj.Largest(a);

            Assert.AreEqual(expectedResult, actualResult);
        }
コード例 #7
0
        public void TestMethod3()
        {
            try
            {
                MethodLibrary.MethodLibrary obj = new MethodLibrary.MethodLibrary();

                int[] a = { 1, 3, 2, 4, 5 };
                int[] expectedResult = { 1, 2, 3, 4, 5 };
                obj.QuickSort(a, 0, 5);

                Assert.AreEqual(expectedResult, a);
            }
            catch (Exception ex)
            {
                ExpectedException = ex;
            }
            Assert.IsNotNull(ExpectedException);
        }
コード例 #8
0
        public void TestLargest_03()
        {
            Exception ExceptedException = null;

            try
            {
                MethodLibrary.MethodLibrary obj = new MethodLibrary.MethodLibrary();

                int[] a = { };
                int   expectedResult = 961611;
                int   actualResult   = obj.Largest(a);

                Assert.AreEqual(expectedResult, actualResult);
            }
            catch (Exception ex)
            {
                ExceptedException = ex;
            }
            Assert.IsNotNull(ExceptedException);
        }
コード例 #9
0
        public void TestDGN()
        {
            Exception ExpectedException = null;

            try
            {
                MethodLibrary.MethodLibrary obj = new MethodLibrary.MethodLibrary();

                string a, b, c;
                a = TestContext.DataRow[0].ToString();
                b = TestContext.DataRow[1].ToString();
                c = TestContext.DataRow[2].ToString();

                string expectedResult = TestContext.DataRow[3].ToString();
                string actualResult   = obj.ThayThe(a, b, c);

                Assert.AreEqual(expectedResult, actualResult);
            }
            catch (Exception ex)
            {
                ExpectedException = ex;
            }
            Assert.IsNotNull(ExpectedException);
        }