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

            var result = await refreshService.GetRefreshTokenByUserId(null);

            Assert.Null(result);
        }
コード例 #2
0
        public async void GetRefreshTokenByUserIdWithWrongId()
        {
            string id = "id";

            RefreshTokenService refreshService = new RefreshTokenService(_repo);

            var result = await refreshService.GetRefreshTokenByUserId(id);

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

            _repo.GetRefreshTokenByUserId(id).Returns(token);

            RefreshTokenService refreshService = new RefreshTokenService(_repo);

            var result = await refreshService.GetRefreshTokenByUserId(id);

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