Exemplo n.º 1
0
        public void AdditionTest2()
        {
            int NumberA = 3;
            int NumberB = 20;
            int Result  = Caculator.Addition(NumberA, NumberB);

            Assert.IsTrue(Result == 23);
        }
Exemplo n.º 2
0
        public void TestAdding2And3()
        {
            // arrange
            double a        = 2;
            double b        = 3;
            double expected = 5;
            var    calc     = new Caculator();
            // act
            double actual = calc.Add(a, b);

            // assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 3
0
        public void CaculatorTotalPoint_WhenInputValidDataAndFailExpectation_ShouldBeFail()
        {
            //Arrage
            ICaculator calulator    = new Caculator();
            var        dataCreation = calulator.Creation();
            var        input        = "ANH";
            var        expected     = 10;

            //Act
            var actutal = calulator.TotalPoints(dataCreation, input);

            //Assert
            Assert.AreNotEqual(expected, actutal);
        }
Exemplo n.º 4
0
        public void CaculatorTotalPoint_WhenInputValidData_ShouldBeSuccess()
        {
            //Arrage
            ICaculator calulator    = new Caculator();
            var        dataCreation = calulator.Creation();
            var        input        = "ANH";
            var        expected     = 6;

            //Act
            var actutal = calulator.TotalPoints(dataCreation, input);

            //Assert
            Assert.AreEqual(expected, actutal);
        }
Exemplo n.º 5
0
        public void CaculatorAddtionData_WhenDataKeysdIsNull_ShouldThrowArgumentNullException()
        {
            //Arrage
            ICaculator caculator         = new Caculator();
            var        expectedParamName = "dataKeys";

            //Act
            try
            {
                var dataCreation = caculator.AddtionData(new Hashtable(), null, 2);
            }
            catch (ArgumentNullException e)
            {
                //Assert
                Assert.AreEqual(expectedParamName, e.ParamName);
            }
        }
Exemplo n.º 6
0
        public void CaculatorTotalPoint_WhenInputIsNull_ShouldThrowArgumentNullException()
        {
            //Arrage
            ICaculator caculator         = new Caculator();
            var        dataCreation      = caculator.Creation();
            var        expectedParamName = "input";
            string     input             = null;

            //Act
            try
            {
                caculator.TotalPoints(dataCreation, input);
            }
            catch (ArgumentNullException e)
            {
                //Assert
                Assert.AreEqual(expectedParamName, e.ParamName);
            }
        }
Exemplo n.º 7
0
        public void CaculatorTotalPoint_WhenDataIsNull_ShouldThrowArgumentNullException()
        {
            //Arrage
            ICaculator caculator         = new Caculator();
            Hashtable  dataCreation      = null;
            var        expectedParamName = "storedData";
            var        input             = "ANH";

            //Act
            try
            {
                caculator.TotalPoints(dataCreation, input);
            }
            catch (ArgumentNullException e)
            {
                //Assert
                Assert.AreEqual(expectedParamName, e.ParamName);
            }
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            // basic
            Console.WriteLine(Human.Sum(1, 9));
            Human a = new Human();

            a.Display();

            // using delegate
            Caculator x = Human.Sum;

            Console.WriteLine(x(1, 9));
            Show y = a.Display;

            y();
            Console.ReadLine();
            // delegate có sẵn trong dotNet
            Func <int, int, int> func = Human.Sum;
            Action          action    = a.Display;
            Predicate <int> predicate = Human.Check;
        }
Exemplo n.º 9
0
 public IActionResult Index(Operation model)
 {
     model.Result = Caculator.Addition(model.NumberA, model.NumberB);
     return(View(model));
 }
Exemplo n.º 10
0
 public void Demo2()
 {
     double result = Caculator.getConeVolume(100, 90);
 }