Exemplo n.º 1
0
        public void TestAddNumbersViaInterface(int x, int y, bool isSuccessful, int expectedResult)
        {
            var mockExternalService = new Mock <IExternalService>();

            mockExternalService.Setup(m => m.DoGreatThings()).Returns(isSuccessful);
            var objExternalService = mockExternalService.Object;

            var calcService = new CalcService();
            var result      = calcService.AddNumbersIfSuccessful(x, y, objExternalService);

            Assert.Equal(expectedResult, result);
        }