Esempio n. 1
0
        public async Task GitUsers_TestAsync()
        {
            using (var client = new ClientProvider().Client)
            {
                var response = await client.GetAsync("api/github/gitusers");

                response.EnsureSuccessStatusCode();
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            }
        }
Esempio n. 2
0
        public async Task GitUsers_TestWithTwoResults(string[] users)
        {
            using (var client = new ClientProvider().Client)
            {
                string param    = string.Join("&", users.Select(x => "usernames=" + x));
                var    response = await client.GetAsync($"api/github/gitusers/?{ param }");

                var gitusers = JsonConvert.DeserializeObject <List <Users> >(response.Content.ReadAsStringAsync().Result);
                Assert.Equal(2, gitusers.Count);
            }
        }
Esempio n. 3
0
        public async Task GitUsers_TestInvalidResults(string[] users)
        {
            using (var client = new ClientProvider().Client)
            {
                string param    = string.Join("&", users.Select(x => "usernames=" + x));
                var    response = await client.GetAsync($"api/github/gitusers/?{ param }");

                var gitusers = JsonConvert.DeserializeObject <List <Users> >(response.Content.ReadAsStringAsync().Result);

                //invaliduser1234
                Assert.Equal("invaliduser1234", gitusers[0].User);
                Assert.Null(gitusers[0].Name);

                //invaliduser5678
                Assert.Equal("invaliduser5678", gitusers[1].User);
                Assert.Null(gitusers[1].Name);
            }
        }
Esempio n. 4
0
        public async Task GitUsers_TestSorting(string[] users)
        {
            using (var client = new ClientProvider().Client)
            {
                string param    = string.Join("&", users.Select(x => "usernames=" + x));
                var    response = await client.GetAsync($"api/github/gitusers/?{ param }");

                var gitusers = JsonConvert.DeserializeObject <List <Users> >(response.Content.ReadAsStringAsync().Result);

                //Sorted by name
                //-----------------------
                //jonsnow1144 - Carl
                //Names - Jesse Andrews
                //caged - Justin Palmer
                //kevinclark - Kevin Clark

                Assert.Equal("Carl", gitusers[0].Name);
                Assert.Equal("Jesse Andrews", gitusers[1].Name);
                Assert.Equal("Justin Palmer", gitusers[2].Name);
                Assert.Equal("Kevin Clark", gitusers[3].Name);
            }
        }