Beispiel #1
0
        public async Task TestAuthenticateApiInvalidCredentials()
        {
            using (var client = new TestClientProvider().Client)
            {
                var response = await client.PostAsync("/api/account/authenticate"
                                                      , new StringContent(
                                                          JsonConvert.SerializeObject(new UserCredentials()
                {
                    Username = "******",
                    Password = "******"         // this test should be unauthorize since paswword is incorrect
                }),
                                                          Encoding.UTF8,
                                                          "application/json"));

                response.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
            }
        }
Beispiel #2
0
        public async Task TestAuthenticateApi()
        {
            using (var client = new TestClientProvider().Client)
            {
                var response = await client.PostAsync("/api/account/authenticate"
                                                      , new StringContent(
                                                          JsonConvert.SerializeObject(new UserCredentials()
                {
                    Username = "******",
                    Password = "******"
                }),
                                                          Encoding.UTF8,
                                                          "application/json"));

                response.EnsureSuccessStatusCode();

                response.StatusCode.Should().Be(HttpStatusCode.OK);
            }
        }