public void should_deserialize_user_from_json()
        {
            // given
            var user = "******";
            var expectedUserEmail = "*****@*****.**";

            var restclientStub = new RestClientMock {RestResponse = new RestResponse {Content = cannedJson}};

            var provider = new TeamcityMembershipProvider(restclientStub);

            // when
            var result = provider.GetUserForUserName(user);

            // then
            Assert.That(result, Is.Not.Null);
            Assert.AreEqual(expectedUserEmail, result.Email);
        }
        public void should_return_team_for_username()
        {
            // given
            var user = "******";
            var team = "Loki";

            var restclientStub = new RestClientMock {RestResponse = new RestResponse {Content = cannedJson}};

            var provider = new TeamcityMembershipProvider(restclientStub);

            // when
            var result = provider.GetTeamNameForUser(user);

            // then
            Assert.That(result, Is.Not.Null);
            Assert.AreEqual(team, result);
        }
示例#3
0
 private HttpClient CreateClient(IRestResponse restResponse)
 {
     _httpLogWriterMock = new HttpLogWriterMock();
     _restClientMock = new RestClientMock();
     _restClientMock.RestResponse = restResponse;
     return new HttpClient(_httpLogWriterMock, _restClientMock);
 }