Exemplo n.º 1
0
        public void AlteredDefaultDataCentre()
        {
            var defaultDataCentre = Configuration.DefaultDataCentre;

            try
            {
                Configuration.DefaultDataCentre = DataCentre.German;

                this.client = new CronofyOAuthClient(clientId, clientSecret);

                var authUrl         = client.GetAuthorizationUrlBuilder(redirectUri).Build();
                var expectedAuthUrl = string.Format(
                    "https://app-de.cronofy.com/oauth/authorize" +
                    "?client_id={0}" +
                    "&response_type=code" +
                    "&redirect_uri={1}" +
                    "&scope=read_account%20read_events%20create_event%20delete_event",
                    UrlBuilder.EncodeParameter(clientId),
                    UrlBuilder.EncodeParameter(redirectUri));

                Assert.AreEqual(expectedAuthUrl, authUrl);
            }
            finally
            {
                Configuration.DefaultDataCentre = defaultDataCentre;
            }
        }
Exemplo n.º 2
0
        public void ExplicitDefaultDataCentre()
        {
            this.client = new CronofyOAuthClient(clientId, clientSecret, "us");

            var authUrl         = client.GetAuthorizationUrlBuilder(redirectUri).Build();
            var expectedAuthUrl = string.Format(
                "https://app.cronofy.com/oauth/authorize" +
                "?client_id={0}" +
                "&response_type=code" +
                "&redirect_uri={1}" +
                "&scope=read_account%20read_events%20create_event%20delete_event",
                UrlBuilder.EncodeParameter(clientId),
                UrlBuilder.EncodeParameter(redirectUri));

            Assert.AreEqual(expectedAuthUrl, authUrl);
        }
        public void HasDefaultScope()
        {
            var authUrl         = client.GetAuthorizationUrlBuilder(redirectUri).Build();
            var expectedAuthUrl = string.Format(
                "https://app.cronofy.com/oauth/authorize" +
                "?client_id={0}" +
                "&response_type=code" +
                "&scope=read_account%20read_events%20create_event%20delete_event" +
                "&redirect_uri={1}",
                UrlBuilder.EncodeParameter(clientId),
                UrlBuilder.EncodeParameter(redirectUri));

            Assert.AreEqual(expectedAuthUrl, authUrl);
        }