public void GetUploadData_MissingFileName_Exception() { var imagekit = new ServerImagekit(GOOD_PUBLICKEY, GOOD_PRIVATEKEY, GOOD_URLENDPOINT) .Tags("tag1"); var ex = Assert.Throws <ArgumentException>(() => imagekit.getUploadData()); Assert.Equal(errorMessages.MISSING_UPLOAD_FILENAME_PARAMETER, ex.Message); }
public void GetUploadData_TagsArray() { var fileName = Guid.NewGuid().ToString(); var imagekit = new ServerImagekit(GOOD_PUBLICKEY, GOOD_PRIVATEKEY, GOOD_URLENDPOINT) .FileName(fileName) .Tags("tag1", "tag2"); var data = imagekit.getUploadData(); Assert.True(data.TryGetValue("tags", out string actualTags), "tags upload data not found"); Assert.Equal("tag1,tag2", actualTags); }
public void GetUploadData_Generic() { var fileName = Guid.NewGuid().ToString(); var imagekit = new ServerImagekit(GOOD_PUBLICKEY, GOOD_PRIVATEKEY, GOOD_URLENDPOINT) .FileName(fileName) .Folder("/test/") .isPrivateFile(true) .UseUniqueFileName(false) .CustomCoordinates("10,10,100,100") .ResponseFields("tags,customCoordinates,isPrivateFile") .Tags("tag1,tag2"); var data = imagekit.getUploadData(); Assert.True(data.TryGetValue("responseFields", out string respFields), "ResponseFields upload data not found"); Assert.True(data.TryGetValue("useUniqueFileName", out string uniqueParam), "UseUniqueFileName upload not found"); Assert.True(data.TryGetValue("folder", out string folder), "folder upload not found"); Assert.Equal("tags,customCoordinates,isPrivateFile", respFields); Assert.Equal("false", uniqueParam); Assert.Equal("/test/", folder); }