public void TestInvalidRedirectUriFormat()
        {
            IContextBuilder <IAuthorizationContext> builder = new AuthorizationContextBuilder();
            string url = CreateUrl("authorization_code", "1234432", "secret", "create-user manage-clients", "mystate", "/callback");

            builder.FromUri(url);
        }
        public void CreateContextFromUriWithoutScope()
        {
            string url = CreateUrl("", "", "", null, "", null);

            IContextBuilder <IAuthorizationContext> builder = new AuthorizationContextBuilder();
            IAuthorizationContext context = builder.FromUri(url);

            Assert.IsNull(context.RedirectUri);
            Assert.AreEqual(new string[0], context.Scope);
        }
        public void CreateContextFromUri()
        {
            string url = CreateUrl("authorization_code", "1234432", "secret", "create-user manage-clients", "mystate", "http://www.mysite.com/callback");

            IContextBuilder <IAuthorizationContext> builder = new AuthorizationContextBuilder();
            IAuthorizationContext context = builder.FromUri(url);

            Assert.AreEqual("authorization_code", context.ResponseType);
            Assert.AreEqual("1234432", context.Client.ClientId);
            Assert.AreEqual("secret", context.Client.ClientSecret);
            Assert.AreEqual(new string[] { "create-user", "manage-clients" }, context.Scope);
            Assert.AreEqual(new Uri("http://www.mysite.com/callback"), context.RedirectUri);
        }
        public void TestInvalidUriFormat()
        {
            IContextBuilder <IAuthorizationContext> builder = new AuthorizationContextBuilder();

            builder.FromUri("/relativeUrl");
        }
        public void CreateContextFromNullUri()
        {
            IContextBuilder <IAuthorizationContext> builder = new AuthorizationContextBuilder();

            builder.FromUri((Uri)null);
        }