Example #1
0
        public void Should_Return7_WhenAdding3to4()
        {
            //arrange
            var calc = new Calc();

            //act
            calc.Add(3, 4);

            //assert
            Assert.That(calc.Result,Is.EqualTo("7"));
        }
Example #2
0
        public void Should_Return4_WhenDivide12And3()
        {
            //arrange
            var calc = new Calc();

            //act
            calc.Divide(12, 3);

            //assert
            Assert.That(calc.Result, Is.EqualTo("4"));
        }
Example #3
0
        public void Should_Return2_WhenSubstract5And3()
        {
            //arrange
            var calc = new Calc();

            //act
            calc.Substract(5, 3);

            //assert
            Assert.That(calc.Result,Is.EqualTo("2"));
        }
Example #4
0
        public void Should_Return15_WhenMultiply3And5()
        {
            //arrange
            var calc = new Calc();

            //act
            calc.Multiply(3, 5);

            //assert
            Assert.That(calc.Result, Is.EqualTo("15"));
        }
Example #5
0
        public void Should_Out4_WhenDivide12And3()
        {
            //arrange
            var calc = new Calc();
            var outer = new Mock<IOut>();
            calc.Out = outer.Object;

            //act
            calc.Divide(12, 3);
            calc.Print();

            //assert
            outer.Verify(it => it.Out("4"));
        }
Example #6
0
        public void Should_ReturnNaN_WhenDivide12And0()
        {
            //arrange
            var calc = new Calc();

            //act
            calc.Divide(12, 0);

            //assert
            Assert.That(calc.Result, Is.EqualTo(float.PositiveInfinity.ToString()));
        }