public void TestUnassignAsync_InterviewerIdIsNull_Throws() { var target = new NfieldSamplingPointInterviewerAssignmentsService(); Assert.Throws <ArgumentNullException>(() => UnwrapAggregateException(target.UnassignAsync(SurveyId, SamplingPointId, null))); }
public void TestUnassignAsync_ServerAcceptsUnassign_ReturnsNoError() { var mockedNfieldConnection = new Mock <INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); mockedHttpClient.Setup(client => client.DeleteAsync(It.IsAny <Uri>())) .Returns(CreateTask(HttpStatusCode.OK)); var target = new NfieldSamplingPointInterviewerAssignmentsService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); target.UnassignAsync(SurveyId, SamplingPointId, InterviewerId).Wait(); mockedHttpClient.Verify(hc => hc.DeleteAsync( It.Is <Uri>(url => url.AbsolutePath.EndsWith("Surveys/" + SurveyId + "/SamplingPoints/" + SamplingPointId + "/Assignments/" + InterviewerId))), Times.Once()); }