public void TestGetAsync_SurveyHasInvitationTemplates_ReturnsInvitationTemplates() { const string surveyId = "TestSurveyId"; var expected1 = new InvitationTemplateModel() { Id = 1, InvitationType = 1, Name = "TestTemplate1", Subject = "TestSubject1", Body = "TestBody1" }; var expected2 = new InvitationTemplateModel() { Id = 2, InvitationType = 2, Name = "TestTemplate2", Subject = "TestSubject2", Body = "TestBody2" }; var target = new NfieldSurveyInvitationTemplatesService(); var returnObject = new[] { expected1, expected2 }; var requestUri = new Uri(ServiceAddress, "Surveys/" + surveyId + "/InvitationTemplates/"); var mockClient = InitMockClientGet <IEnumerable <InvitationTemplateModel> >(requestUri, returnObject); target.InitializeNfieldConnection(mockClient); var actualResults = target.GetAsync(surveyId).Result.ToArray(); Assert.Equal(expected1, actualResults[0], new InvitationTemplateComparer()); Assert.Equal(expected2, actualResults[1], new InvitationTemplateComparer()); }
public void TestGetAsync_SurveyIdIsEmpty_Throws() { var target = new NfieldSurveyInvitationTemplatesService(); Assert.Throws <ArgumentException>(() => UnwrapAggregateException(target.GetAsync(" "))); }