public async Task CheckUrlMakesRequestWhichReturnsSuccessfullyThenReturnsValid()
        {
            //Arrange
            var token        = "ABC";
            var url          = "TokenUrl";
            var expectedCode = HttpStatusCode.OK;

            A.CallTo(() => _urlBuilder.GetCheckTokenUrl()).Returns(url);
            A.CallTo(() => _getRequestMaker.MakeGetRequestStatusCode(url, token)).Returns(expectedCode);
            A.CallTo(() => _statusCodeHandler.HandleTokenCheckStatusCode(expectedCode)).Returns("Valid");

            //Act
            var actual = await _getRequestHandler.CheckToken(token);

            //Assert
            Assert.AreEqual("Valid", actual);
        }
        public async Task CheckTokenCallsHttpHandlerAndReturnsAStringAsync()
        {
            //Arrange
            var token = "ABC";

            A.CallTo(() => _getRequestHandler.CheckToken(token)).Returns("Valid");

            //Act
            var actual = await _ApiGateway.CheckToken(token);

            //Assert
            Assert.AreEqual("Valid", actual);
        }
Exemple #3
0
        public async Task <string> CheckToken(string accessToken)
        {
            var response = await _getRequestHandler.CheckToken(accessToken);

            return(response);
        }