public void InvalidActionTest() { BarLogic barLogic = new BarLogic(null, null); Assert.Throws(typeof(ArgumentException), ()=>{ barLogic.Calc('*', 0, 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(); }