public async void GetAccessToken_ForInvalidCode_ReturnsNull()
        {
            var uberClient = new UberAuthenticationClient(_clientId, _clientSecret);

            var response = await uberClient.GetAccessTokenAsync("INVALID", "https://sandbox-api.uber.com/");

            Assert.Null(response);
        }
        public async void GetAccessToken_ForValidCode_ReturnsValidAccessToken()
        {
            var uberClient = new UberAuthenticationClient(_clientId, _clientSecret);

            var response = await uberClient.GetAccessTokenAsync("TODO", "https://sandbox-api.uber.com/");

            response.ShouldNotBe(null);
            response.ShouldBeOfType <AccessToken>();
            response.Value.ShouldNotBeNullOrEmpty();
        }
        public async void GetAccessToken_ForValidCode_ReturnsValidAccessToken()
        {
            var uberClient = new UberAuthenticationClient(_clientId, _clientSecret);

            var response = await uberClient.GetAccessTokenAsync("TODO", "https://sandbox-api.uber.com/");

            Assert.NotNull(response);
            Assert.IsType <AccessToken>(response);
            Assert.NotNull(response.Value);
            Assert.NotEmpty(response.Value);
        }
Exemple #4
0
        [Route(@"api/message/uber")] //webhook uri part
        public async Task <HttpResponseMessage> Uber(string code = "", string state = "")
        {
            var path     = "your path to index.html";
            var response = new HttpResponseMessage();

            response.Content = new StringContent("<html><body><a align = \"center\" style = \"color:#0088cc; font-size:30px\"  href=\"https://teleg.run/uber_delivery_bot\" ><h1>Авторизация прошла успешно. Вернуться в Telegram</h1> </a></body></html> ");
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
            var authClient  = new UberAuthenticationClient("rj7tZtjxSQwh7sxBDEZyU9Q5_10WBvPD", "lVtEEJJcJKSz_ie-8OSofKa6P9n_-gICXPx8ZyWh");
            var accessToken = authClient.GetAccessTokenAsync(code, "https://fffb3ee5.ngrok.io/api/message/ubertoken");

            return(response);
        }