Esempio n. 1
0
        public async Task SalesTestGet_OkAsync(string url)
        {
            await _client.LogInAsync();

            var response = await _client.GetAsync(url);

            response.EnsureSuccessStatusCode();
            var str = await response.Content.ReadAsStringAsync();

            str.IsValidJson().Should().BeTrue();
        }
Esempio n. 2
0
        public async Task GetAsync_Search_Without_ResultsAsync(string course, bool logIn, int page)
        {
            if (logIn)
            {
                await _client.LogInAsync();
            }
            var response = await _client.GetAsync($"api/feed?Course={course}&page={page}");

            response.EnsureSuccessStatusCode();
            //var str = await response.Content.ReadAsStringAsync();

            //str.Should().BeEmpty();
        }
Esempio n. 3
0
        public async Task GetAsyncWithCourse_ReturnResult_OKAsync(bool logIn)
        {
            if (logIn)
            {
                await _client.LogInAsync();
            }
            var response = await _client.GetAsync("api/tutor?course=Economics");

            response.EnsureSuccessStatusCode();
            var str = await response.Content.ReadAsStringAsync();

            str.IsValidJson().Should().BeTrue();
        }
Esempio n. 4
0
        public async Task AccountApiTestGet_LogIn_OkAsync(string api)
        {
            await _client.LogInAsync();

            var response = await _client.GetAsync(api);

            response.EnsureSuccessStatusCode();
            if (response.StatusCode != HttpStatusCode.NoContent)
            {
                var str = await response.Content.ReadAsStringAsync();

                str.IsValidJson().Should().BeTrue("the invalid string is {0}", str);
            }

            //response.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
        }
        public async Task GetSimilarDocuments_OkAsync(string url, string course, long documentId, bool authUser)
        {
            var endPoint = $"{url}?course={course}&documentId={documentId}";

            if (authUser)
            {
                await _client.LogInAsync();
            }
            var response = await _client.GetAsync(endPoint);

            response.StatusCode.Should().Be(200);

            var str = await response.Content.ReadAsStringAsync();

            str.IsValidJson().Should().BeTrue("the invalid string is {0}", str);
        }
Esempio n. 6
0
        public async Task Logout_RedirectAsync()
        {
            await _client.LogInAsync();

            var response = await _client.GetAsync(_uri.Path);

            response.StatusCode.Should().Be(HttpStatusCode.Redirect);
        }
Esempio n. 7
0
        public async Task ChatApiTestGet_LogIn_OkAsync(string api)
        {
            await _client.LogInAsync();

            var response = await _client.GetAsync(api);

            response.StatusCode.Should().Be(HttpStatusCode.OK);
            var str = await response.Content.ReadAsStringAsync();

            str.IsValidJson().Should().BeTrue();
        }
Esempio n. 8
0
        public async Task Get_SomeCourse_ReturnResultAsync(string url)
        {
            await _client.LogInAsync();

            var response = await _client.GetAsync(url);

            response.EnsureSuccessStatusCode();

            var str = await response.Content.ReadAsStringAsync();

            str.IsValidJson().Should().BeTrue("the invalid string is {0}", str);
        }
Esempio n. 9
0
        public async Task GetAsync_StudyRoom_OkAsync(string uri)
        {
            await _client.LogInAsync();

            var response = await _client.GetAsync(uri);

            response.EnsureSuccessStatusCode();

            using (var conn = _fixture.DapperRepository.OpenConnection())
            {
                var studyRoomId = conn.QueryFirst <Guid>("select top 1 id from sb.studyroom where tutorid = 159489");
                uri += studyRoomId.ToString();
            }

            response = await _client.GetAsync(uri);

            response.EnsureSuccessStatusCode();
            var str = await response.Content.ReadAsStringAsync();

            str.IsValidJson().Should().BeTrue();
        }
Esempio n. 10
0
        public async Task ChatApiTestGet_NotLogIn_UnauthorizedAsync(string api)
        {
            await _client.LogInAsync();

            var _ = await _client.GetAsync(api);
        }
Esempio n. 11
0
 public async Task Post_Login_With_EmailAsync()
 {
     await _client.LogInAsync();
 }