public RemoveAsync ( string surveyId, int code ) : System.Threading.Tasks.Task | ||
surveyId | string | |
code | int | |
Résultat | System.Threading.Tasks.Task |
public void TestRemoveAsync_ValidSurveyResponseCode_CallsCorrectUrl() { // Arrange const string surveyId = "surveyId"; const int code = 10; var mockedNfieldConnection = new Mock<INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); mockedHttpClient.Setup(client => client.DeleteAsync(It.IsAny<string>())) .Returns(CreateTask(HttpStatusCode.OK)); var target = new NfieldSurveyResponseCodesService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); // Act target.RemoveAsync(surveyId, code).Wait(); // Assert mockedHttpClient.Verify(hc => hc.DeleteAsync(It.Is<string>( url => url.EndsWith(string.Format("Surveys/{0}/ResponseCodes/{1}", surveyId, code)))), Times.Once()); }
public void TestRemoveAsync_SurveyIdIsNull_Throws() { var target = new NfieldSurveyResponseCodesService(); Assert.Throws<ArgumentNullException>(() => UnwrapAggregateException(target.RemoveAsync(null, 10))); }