コード例 #1
0
        public async void GetRefreshTokenByValueWithWrongId()
        {
            RefreshTokenService refreshService = new RefreshTokenService(_repo);

            var result = await refreshService.GetRefreshTokenByValue("id");

            Assert.Null(result);
        }
コード例 #2
0
        public async void GetRefreshTokenByValueWithRightId()
        {
            string tokenValue = "tokenValue";
            var    token      = new RefreshToken
            {
                TokenValue = tokenValue,
                UserId     = "id"
            };

            _repo.GetRefreshTokenByValue(tokenValue).Returns(token);

            RefreshTokenService refreshService = new RefreshTokenService(_repo);

            var result = await refreshService.GetRefreshTokenByValue(tokenValue);

            Assert.NotNull(result);
            Assert.IsType <RefreshToken>(result);
            Assert.NotNull(result.TokenValue);
            Assert.NotNull(result.UserId);
            Assert.Equal(result.TokenValue, tokenValue);
        }