public void TestAddImage_FilenameIsWhitespace_Throws() { var target = new NfieldSurveyInvitationImagesService(); Assert.Throws <ArgumentException>(() => UnwrapAggregateException(target.AddImageAsync("survey", " ", new MemoryStream()))); }
public void TestAddImage_ContentIsNull_Throws() { var target = new NfieldSurveyInvitationImagesService(); Assert.Throws <ArgumentNullException>(() => UnwrapAggregateException(target.AddImageAsync("survey", "somefilename", null))); }
public void TestAddImage_SurveyIsEmpty_Throws() { var target = new NfieldSurveyInvitationImagesService(); Assert.Throws <ArgumentException>(() => UnwrapAggregateException(target.AddImageAsync(string.Empty, "somefilename", new MemoryStream()))); }
public void TestAddImage_AllParamsOk_Successful() { const string surveyId = "surveyWithImages"; const string filename = "imageForSurvey"; var target = new NfieldSurveyInvitationImagesService(); var mockClient = InitMockClient(surveyId, filename); target.InitializeNfieldConnection(mockClient); AddInvitationImageResult actual; using (var stream = new MemoryStream(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 })) { actual = target.AddImageAsync(surveyId, filename, stream).Result; } Assert.NotEmpty(actual.Link); Assert.True(actual.Link.Contains(surveyId)); Assert.True(actual.Link.Contains(filename)); }