public void Test_AddMethodLogsSomeValue_Called()
        {
            // arrange
            var math = new MathWebClient(_apiClient, _databaseLogger);

            // arrange mocking
            _apiClient.Get(Arg.Any <string>()).Returns((1 + 2).ToString());

            // act
            _ = math.Add(1, 2);

            // assert
            _databaseLogger.ReceivedWithAnyArgs().Log(default);
        public void Divide_Inputs_Returns_AppropriateValue(int a, int b, int expectedResult)
        {
            // arrange
            var math = new MathWebClient(_apiClient, _databaseLogger);

            // arrange mocking
            _apiClient.Get(Arg.Any <string>()).Returns((a / b).ToString());
            _databaseLogger.Log(Arg.Any <RequestLogDBModel>()).Returns(1);

            // act
            var actualResult = math.Divide(a, b);

            // assert
            Assert.AreEqual(expectedResult, actualResult);
        }
Пример #3
0
 public MathController(MathWebClient mathWebClient)
 {
     _mathWebClient = mathWebClient;
 }