public void Test_Power2_NOk()
        {
            var expertOperation = new ExpertOperation(new AdvancedOperation(new BasicOperation()));
            var resuts          = expertOperation.Power(5, 2);

            Assert.AreEqual(false, resuts);
        }
        public void Test_Power2_Ok()
        {
            var expertOperation = new ExpertOperation(new AdvancedOperation(new BasicOperation()));
            var resuts          = expertOperation.Power2(2, 4);

            Assert.AreEqual(true, resuts);
        }
        public void Test_Expert_Ok()
        {
            var advancedOperation = new Mock <IAdvancedOperation>();

            advancedOperation.Setup(x => x.Multiply(It.IsAny <int>(), It.IsAny <int>())).Returns(1);

            var expertOperation = new ExpertOperation(advancedOperation.Object);
            var resuts          = expertOperation.Exponentiation(2, 5);

            Assert.AreEqual(1, resuts);
            advancedOperation.Verify(mock => mock.Multiply(It.IsAny <int>(), It.IsAny <int>()), Times.Exactly(4));
        }
        public void Test_Power_NOk()
        {
            var advancedOperation = new Mock <IAdvancedOperation>();

            advancedOperation.Setup(x => x.Multiply(It.IsAny <int>(), It.IsAny <int>())).Returns(1);

            var expertOperation = new ExpertOperation(advancedOperation.Object);
            var resuts          = expertOperation.Power(5, 2);

            Assert.AreEqual(false, resuts);
            advancedOperation.Verify(mock => mock.Multiply(It.IsAny <int>(), It.IsAny <int>()), Times.Exactly(1));
        }
Exemple #5
0
        static void Main(string[] args)
        {
            var             advancedOperation = new AdvancedOperation(new BasicOperation());
            ExpertOperation expertOperation   = new ExpertOperation(advancedOperation);
            var             i = advancedOperation.Multiply(100, 4);
            var             j = advancedOperation.Division(100, 5);

            advancedOperation.GetFibbonacci(10);
            expertOperation.Exponentiation(2, 5);
            expertOperation.Power(4, 16);
            expertOperation.Power2(4, 16);
            Console.ReadKey();
        }