public void TestRemoveAsync_SurveyIdIsEmpty_Throws() { var target = new NfieldSurveyInvitationTemplatesService(); Assert.Throws <ArgumentException>(() => UnwrapAggregateException(target.RemoveAsync(" ", 0))); }
public void TestRemoveAsync_InvitationTemplateIsRemoved_ReturnsTrue() { const string surveyId = "TestSurveyId"; const int templateId = 42; var mockedNfieldConnection = new Mock <INfieldConnectionClient>(); var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection); var content = new StringContent(JsonConvert.SerializeObject(new { IsSuccess = true })); mockedHttpClient .Setup(client => client.DeleteAsync(new Uri(ServiceAddress, "Surveys/" + surveyId + "/InvitationTemplates/" + templateId))) .Returns(CreateTask(HttpStatusCode.OK, content)); var target = new NfieldSurveyInvitationTemplatesService(); target.InitializeNfieldConnection(mockedNfieldConnection.Object); var actual = target.RemoveAsync(surveyId, templateId).Result; Assert.Equal(true, actual); }