Exemple #1
0
        public void Login_OutputsToken()
        {
            var login      = SetupExampleLogin();
            var user       = SetupExampleUserData();
            var httpClient = new Mock <IHttpClient>();

            httpClient.SetupRequest("http://localhost/", "api/v3/users/login")
            .WithContentType(CONTENT_TYPE)
            .Post(login.SerializeToPayload())
            .Responses(user.SerializeToPayload())
            .WithToken(TOKEN);
            var sut = new RestServiceImpl(httpClient.Object);

            string token;

            sut.Login(Uri, login, out token);

            Assert.That(token, Is.EqualTo(TOKEN));
        }