public void TestChangePasswordAsync_InterviewerIsNull_ThrowsArgumentNullException() { var target = new NfieldInterviewersService(); Assert.Throws(typeof(ArgumentNullException), () => UnwrapAggregateException(target.ChangePasswordAsync(null, string.Empty))); }
public void TestChangePasswordAsync_ServerChangesPassword_ReturnsInterviewer() { const string Password = "******"; const string InterviewerId = "Interviewer X"; var interviewer = new Interviewer {InterviewerId = InterviewerId }; var mockedNfieldConnection = new Mock<INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); mockedHttpClient .Setup(client => client.PutAsJsonAsync(ServiceAddress + "interviewers/" + InterviewerId, It.IsAny<object>())) .Returns(CreateTask(HttpStatusCode.OK, new StringContent(JsonConvert.SerializeObject(interviewer)))); var target = new NfieldInterviewersService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); var actual = target.ChangePasswordAsync(interviewer, Password).Result; Assert.Equal(interviewer.InterviewerId, actual.InterviewerId); }