public void TestUpdateAsync_InterviewerExists_ReturnsInterviewer() { const string InterviewerId = "Interviewer X"; var interviewer = new Interviewer { InterviewerId = InterviewerId, FirstName = "XXX" }; var mockedNfieldConnection = new Mock<INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); mockedHttpClient .Setup(client => client.PatchAsJsonAsync(ServiceAddress + "interviewers/" + InterviewerId, It.IsAny<UpdateInterviewer>())) .Returns(CreateTask(HttpStatusCode.OK, new StringContent(JsonConvert.SerializeObject(interviewer)))); var target = new NfieldInterviewersService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); var actual = target.UpdateAsync(interviewer).Result; Assert.Equal(interviewer.FirstName, actual.FirstName); }
public void TestUpdateAsync_InterviewerArgumentIsNull_ThrowsArgumentNullException() { var target = new NfieldInterviewersService(); Assert.Throws<ArgumentNullException>(() => UnwrapAggregateException(target.UpdateAsync(null))); }