public void Add_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.Add(a, b); // assert Assert.AreEqual(expectedResult, actualResult); }
public int Add(int a, int b) { string apiRoute = $"api/math/Add/{a}/{b}"; try { string responseStr = _apiClient.Get(apiRoute); int sum = Convert.ToInt32(responseStr); LogRequest(apiRoute, true); return(sum); } catch (Exception) { LogRequest(apiRoute, false); throw; } }