public void execute_returns_null_user_name_when_missing_token()
        {
            var request = new HttpRequestMessage();
            var actual = new SimppleTokenUserNameQuery().Execute(request);

            Assert.Null(actual);
        }
        public void execute_returns_null_on_invalid_header_value(string headerValue)
        {
            var request = new HttpRequestMessage();
            request.Headers.Authorization = new AuthenticationHeaderValue(
                                                    "Bearer",
                                                    headerValue);

            var actual = new SimppleTokenUserNameQuery().Execute(request);

            Assert.Null(actual);
        }
        public void execute_returns_null_on_invalid_schema(string schema)
        {
            var request = new HttpRequestMessage();
            request.Headers.Authorization = new AuthenticationHeaderValue(
                                                    schema,
                                                    new SimpleToken(new Claim("userName", "bob")).ToString());

            var actual = new SimppleTokenUserNameQuery().Execute(request);

            Assert.Null(actual);
        }
        public void execute_returns_correct_user_name_on_valid_token(string userName)
        {
            var request = new HttpRequestMessage();
            request.Headers.Authorization = new AuthenticationHeaderValue(
                                                    "Bearer",
                                                    new SimpleToken(new Claim("userName", userName)).ToString());

            var actual = new SimppleTokenUserNameQuery().Execute(request);

            Assert.Equal(userName, actual);
        }