示例#1
0
 public void InvalidMask()
 {
     Assert.Throws <InvalidImageMaskException>(
         () => ImageMaskUtil.ZipImageIdMask("0123abc", new List <IFormFile>()));
     Assert.Throws <InvalidImageMaskException>(
         () => ImageMaskUtil.ZipImageIdMask("0129", new List <IFormFile>()));
     Assert.Throws <InvalidImageMaskException>(
         () => ImageMaskUtil.ZipImageIdMask("0121", new List <IFormFile> {
         null, null, null, null
     }));
 }
示例#2
0
        public void ValidMask()
        {
            var formFiles = new IFormFile[]
            {
                new MockFormFile(), new MockFormFile(), new MockFormFile()
            };
            var result = ImageMaskUtil.ZipImageIdMask("351", formFiles);

            Assert.Equal(3, result.Count);
            Assert.Same(result[1], formFiles[2]);
            Assert.Same(result[3], formFiles[0]);
            Assert.Same(result[5], formFiles[1]);
        }
示例#3
0
 public void NullMask()
 {
     Assert.Throws <ArgumentNullException>(() => ImageMaskUtil.ExtractImageIdFromMask(null));
 }
示例#4
0
 public void ValidMask()
 {
     Assert.Equal(new [] { 0, 8, 1, 5 }, ImageMaskUtil.ExtractImageIdFromMask("0815"));
 }
示例#5
0
 public void EmptyMask()
 {
     Assert.Empty(ImageMaskUtil.ExtractImageIdFromMask(string.Empty));
 }
示例#6
0
 public void InvalidMask()
 {
     Assert.Throws <InvalidImageMaskException>(() => ImageMaskUtil.ExtractImageIdFromMask("0123abc"));
     Assert.Throws <InvalidImageMaskException>(() => ImageMaskUtil.ExtractImageIdFromMask("01239"));
     Assert.Throws <InvalidImageMaskException>(() => ImageMaskUtil.ExtractImageIdFromMask("01421"));
 }
示例#7
0
 public void EmptyMask()
 {
     Assert.Empty(ImageMaskUtil.ZipImageIdMask(string.Empty, new List <IFormFile>()));
 }
示例#8
0
 public void InconsistentNumberOfImages()
 {
     Assert.Throws <InvalidImageMaskException>(
         () => ImageMaskUtil.ZipImageIdMask("01", new IFormFile[1]));
 }
示例#9
0
 public void NullMaskOrFiles()
 {
     Assert.Throws <ArgumentNullException>(() => ImageMaskUtil.ZipImageIdMask(null, null));
     Assert.Throws <ArgumentNullException>(() => ImageMaskUtil.ZipImageIdMask(null, new List <IFormFile>()));
     Assert.Throws <ArgumentNullException>(() => ImageMaskUtil.ZipImageIdMask(string.Empty, null));
 }