Exemplo n.º 1
0
        public void Stub()
        {
            IGrabber  imageGrab = new ImageVideoGrabber.Grabber();
            ImageFile fileInput = new ImageFile();

            fileInput.FileName = txtFilePath.Text;
            //test1

            var result = imageGrab.ExtractTextFromImage(fileInput);
            var v      = result;

            //test2
            fileInput.FileName = txtFilePath.Text;
            List <Colors> result2 = imageGrab.GetImageColors(fileInput);
            var           v2      = result2;

            //test3
            VideoFileDetail videoFielOutput   = new VideoFileDetail();
            string          frameName         = Guid.NewGuid().ToString();
            string          outputImgFilePath = appStartPath + @"\bin\img\";
            string          filePath          = txtFilePath.Text.ToString().Trim();
            string          batchFilePath     = appStartPath + @"\ff-prompt.bat";

            videoFielOutput.ApplicationStartupPath = appStartPath;
            videoFielOutput.OutputImagePath        = outputImgFilePath;
            videoFielOutput.InputFilePath          = filePath;
            videoFielOutput.BatchFilePath          = batchFilePath;

            var result3 = imageGrab.GetVideoDetails(videoFielOutput);
            var v3      = result3;

            //test4
            ImageFileDetails imageFileDupCheck = new ImageFileDetails();
            string           targetDirPath     = @"D:\git-code\ImageProcessing\KantarImageProcessing\ImageProcessing\bin\Debug\bin\img";

            imageFileDupCheck.FilePath               = txtFilePath.Text.ToString();
            imageFileDupCheck.FileLength             = 100000;
            imageFileDupCheck.FolderPath             = targetDirPath;
            imageFileDupCheck.ApplicationStartupPath = appStartPath;
            var result4 = imageGrab.GetAllSimilarImages(imageFileDupCheck);
            var v4      = result4;

            //upload image
            imageGrab.UploadImageFile(txtFilePath.Text.ToString(), appStartPath);

            //download file
            string imagePath = txtFilePath.Text.ToString();

            imageGrab.DownloadFile(imagePath.Contains("\\") ? imagePath.Split('\\')[imagePath.Split('\\').Count() - 1] : imagePath);
        }
        public void GetVideoDetailsForWhenFolderStructureNotCreated()
        {
            //Arrange
            VideoFileDetail videoObj          = new VideoFileDetail();
            string          appStartPath      = @"D:\git-code\ImageProcessing\KantarImageProcessing\Test.ImageVideoGrabber\bin\Debug";//Application.StartupPath;
            string          frameName         = Guid.NewGuid().ToString();
            string          outputImgFilePath = appStartPath + @"\bin\img1\";
            string          filePath          = @"D:\videos\images\unitTest\bill2.mp4";
            string          batchFilePath     = appStartPath + @"\a\a\ff-prompt.bat";

            videoObj.ApplicationStartupPath = appStartPath;
            videoObj.OutputImagePath        = outputImgFilePath;
            videoObj.InputFilePath          = filePath;
            videoObj.BatchFilePath          = batchFilePath;
            //Act
            VideoContent actualOutput = _grab.GetVideoDetails(videoObj);
        }
        public void GetVideoDetailsForValidBlankVideo()
        {
            //Arrange
            VideoFileDetail videoObj          = new VideoFileDetail();
            string          appStartPath      = @"D:\git-code\ImageProcessing\KantarImageProcessing\Test.ImageVideoGrabber\bin\Debug";//Application.StartupPath;
            string          frameName         = Guid.NewGuid().ToString();
            string          outputImgFilePath = appStartPath + @"\bin\img\";
            string          filePath          = @"D:\videos\images\unitTest\blank.mp4";
            string          batchFilePath     = appStartPath + @"\ff-prompt.bat";

            videoObj.ApplicationStartupPath = appStartPath;
            videoObj.OutputImagePath        = outputImgFilePath;
            videoObj.InputFilePath          = filePath;
            videoObj.BatchFilePath          = batchFilePath;
            //Act
            VideoContent actualOutput = _grab.GetVideoDetails(videoObj);

            //Assert
            Assert.IsTrue(actualOutput != null, "Exception occourred in getting video details for valid blank video file");
        }
        public void GetVideoDetailsForInvalidVideoPath()
        {
            //Arrange
            VideoFileDetail videoObj          = new VideoFileDetail();
            string          appStartPath      = @"D:\git-code\ImageProcessing\KantarImageProcessing\Test.ImageVideoGrabber\bin\Debug";//Application.StartupPath;
            string          frameName         = Guid.NewGuid().ToString();
            string          outputImgFilePath = appStartPath + @"\bin\img\";
            string          filePath          = @":\videos\images\unitTest\bill2.mp4";
            string          batchFilePath     = appStartPath + @"\ff-prompt.bat";

            videoObj.ApplicationStartupPath = appStartPath;
            videoObj.OutputImagePath        = outputImgFilePath;
            videoObj.InputFilePath          = filePath;
            videoObj.BatchFilePath          = batchFilePath;
            //Act
            VideoContent actualResult = _grab.GetVideoDetails(videoObj);

            //Assert
            Assert.IsTrue((actualResult.AudioMessage == "" && actualResult.ColorList.Count == 0 && actualResult.ContentMessage == "" && actualResult.VideoInfo == ""),
                          "Exception occurred in getting video details from invalid video path");
        }