示例#1
0
        private MockResponseHandler GetAuthenticatedMessageHandler()
        {
            var mockReponseHandler = new MockResponseHandler();

            var response = new HttpResponseMessage(HttpStatusCode.Accepted);

            response.AddAuthenticationCookie();
            mockReponseHandler.AddAuthenticationResponseHandler(BaseAddress);

            return(mockReponseHandler);
        }
示例#2
0
        public async Task TestLogin()
        {
            var mockReponseHandler = new MockResponseHandler();

            mockReponseHandler.AddAuthenticationResponseHandler(BaseAddress);

            var clientFactory = new HttpClientFactory(mockReponseHandler);

            var client = clientFactory.Create(BaseAddress);


            var user = new User
            {
                Login    = "******",
                Password = "******".ToSecureString()
            };

            var loginClient = new YouTrackClient(client, user);

            var success = await loginClient.AuthenticateAsync(user);

            Assert.IsTrue(success);
        }