예제 #1
0
        public void InvalidActionTest()
        {
            BarLogic barLogic = new BarLogic(null, null);

            Assert.Throws(typeof(ArgumentException), ()=>{
                barLogic.Calc('*', 0, 0);
            });
        }
예제 #2
0
        public void PlusNotShow()
        {
            int a = 0, b = 0;

            var calculateServiceMock = new Mock<ICalculateService>(MockBehavior.Strict);
            calculateServiceMock.Setup(m => m.Plus(It.IsAny<int>(), It.IsAny<int>())).Returns(() => a + b);

            BarLogic barLogic = new BarLogic(null, calculateServiceMock.Object);

            a = 1;
            b = 2;
            Assert.AreEqual(barLogic.Calc('+', a, b), a + b);

            a = 5;
            b = 10;
            Assert.AreEqual(barLogic.Calc('+', a, b), a + b);

            calculateServiceMock.VerifyAll();
        }