Пример #1
0
        public void ParseFromQuery_EmptyQuery_ReturnsNull()
        {
            var userAccountRecoveryUrlHelper = new AuthorizedTaskTokenUrlHelper();

            var queryCollection = new QueryCollection();

            var result = userAccountRecoveryUrlHelper.ParseTokenFromQuery(queryCollection);

            Assert.Null(result);
        }
Пример #2
0
        public void ParseFromQuery_WhenSimpleQuery_CanParseToken()
        {
            var userAccountRecoveryUrlHelper = new AuthorizedTaskTokenUrlHelper();

            var url             = userAccountRecoveryUrlHelper.MakeUrl(ABSOLUTE_BASE_URI, SIMPLE_TOKEN);
            var query           = new Uri(url).Query;
            var values          = QueryHelpers.ParseQuery(query);
            var queryCollection = new QueryCollection(values);

            var parsed = userAccountRecoveryUrlHelper.ParseTokenFromQuery(queryCollection);

            Assert.Equal(SIMPLE_TOKEN, parsed);
        }
Пример #3
0
        public void ParseFromQuery_WhenTokenContainsInvalidChars_CanParseToken()
        {
            var userAccountRecoveryUrlHelper = new AuthorizedTaskTokenUrlHelper();

            var token           = "notEscaped /?:=&\" <>#%{}|\\^[]`";
            var url             = userAccountRecoveryUrlHelper.MakeUrl(ABSOLUTE_BASE_URI, token);
            var query           = new Uri(url).Query;
            var values          = QueryHelpers.ParseQuery(query);
            var queryCollection = new QueryCollection(values);

            var parsed = userAccountRecoveryUrlHelper.ParseTokenFromQuery(queryCollection);

            Assert.Equal(token, parsed);
        }