예제 #1
0
        public HttpResponseMessage Index()
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK);
            //response.Content = new StringContent(Convert.ToString(a + b));
            var test = _mathWebClient.Add(2, 3);

            return(response);
        }
        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 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);
        }