public void ChangeFlagToFree()
        {
            var MultiThreadResizer = new MultiThreadResizerWorker(CountOfThreads, CountOfImage);
            Assert.AreEqual(GetFakeShortSummary(0, 0, 0, 0, 0, 0), MultiThreadResizer.ShortStateSummary);
            MultiThreadResizer.SetFolderWithImages(Path);

            Assert.AreEqual(GetFakeShortSummary(CountFiles,
                CountFiles * MultiThreadResizer.ListOfResizeSettings.Count,
                CountFiles * MultiThreadResizer.ListOfResizeSettings.Count,
                0, 0, 0), MultiThreadResizer.ShortStateSummary);
            var result = MultiThreadResizer.TakeImagesForThread();

            Assert.AreEqual(GetFakeShortSummary(CountFiles,
                CountFiles * MultiThreadResizer.ListOfResizeSettings.Count,
                CountFiles * MultiThreadResizer.ListOfResizeSettings.Count - CountOfThreads * CountOfImage,
                CountOfThreads * CountOfImage, 0, 0), MultiThreadResizer.ShortStateSummary);

            MultiThreadResizer.ChangeFlagToFree(result);

            Assert.AreEqual(GetFakeShortSummary(CountFiles,
                CountFiles * MultiThreadResizer.ListOfResizeSettings.Count,
                CountFiles * MultiThreadResizer.ListOfResizeSettings.Count,
                0, 0, 0), MultiThreadResizer.ShortStateSummary);
        }
        public void ResizeImages()
        {
            var MultiThreadResizer = new MultiThreadResizerWorker(CountOfThreads, CountOfImage);
            MultiThreadResizer.NameSubFolderForNewFiles = @"\NewImages\ResizeImages";
            MultiThreadResizer.SetFolderWithImages(Path);
            var images = MultiThreadResizer.TakeImagesForThread();
            MultiThreadResizer.ResizeImages(images);
            Assert.AreEqual(string.Concat("Sized =", images.Count, " Successfully =", images.Count, " with errors=", 0), MultiThreadResizer.GetLogMessage());
            Assert.AreEqual(images.Count, images.Where(f => MultiThreadResizer.ListOfFileAndCustomResizeSettings[f].Status == 3).Count());

            var images2 = MultiThreadResizer.TakeImagesForThread();
            MultiThreadResizer.ResizeImages(images2);
            Assert.AreEqual(string.Concat("Sized =", images2.Count, " Successfully =", images2.Count, " with errors=", 0), MultiThreadResizer.GetLogMessage());
            Assert.AreEqual(images2.Count, images2.Where(f => MultiThreadResizer.ListOfFileAndCustomResizeSettings[f].Status == 3).Count());
            Assert.AreEqual(CountOfImage, MultiThreadResizer.ListOfFileAndCustomResizeSettings.Where(f => f.Value.Status == 3).Count());
        }
        public void TakeImagesForThread()
        {
            var MultiThreadResizer = new MultiThreadResizerWorker(CountOfThreads, CountOfImage);
            MultiThreadResizer.SetFolderWithImages(Path);

            var result = MultiThreadResizer.TakeImagesForThread();

            Assert.AreEqual(CountOfImage, result.Count);
            Assert.AreEqual(CountOfImage,
                result.Where(f=> MultiThreadResizer.ListOfFileAndCustomResizeSettings[f].Status==2).Count());
            result = MultiThreadResizer.TakeImagesForThread();

            Assert.AreEqual(0, result.Count);
            Assert.AreEqual(0,
                result.Where(f => MultiThreadResizer.ListOfFileAndCustomResizeSettings[f].Status == 2).Count());
        }
 public void StateSummary()
 {
     int CountOfImage = 10;
     var MultiThreadResizer = new MultiThreadResizerWorker(2, CountOfImage);
     MultiThreadResizer.NameSubFolderForNewFiles = @"\NewImages\StateSummary";
     Assert.AreEqual(GetFakeShortSummary(0, 0, 0, 0, 0, 0),MultiThreadResizer.ShortStateSummary);
     MultiThreadResizer.SetFolderWithImages(Path);
     Assert.AreEqual(GetFakeShortSummary(CountFiles, CountFiles * MultiThreadResizer.ListOfResizeSettings.Count, CountFiles * MultiThreadResizer.ListOfResizeSettings.Count, 0, 0, 0),MultiThreadResizer.ShortStateSummary);
 }
 public void StartResizing()
 {
     var MultiThreadResizer = new MultiThreadResizerWorker(CountOfThreads, CountOfImage);
     MultiThreadResizer.NameSubFolderForNewFiles = @"\NewImages\StartResizing";
     Assert.AreEqual(GetFakeShortSummary(0, 0, 0, 0, 0,0), MultiThreadResizer.ShortStateSummary);
     MultiThreadResizer.SetFolderWithImages(Path);
     Assert.AreEqual(GetFakeShortSummary(CountFiles, CountFiles * MultiThreadResizer.ListOfResizeSettings.Count, CountFiles * MultiThreadResizer.ListOfResizeSettings.Count, 0, 0, 0), MultiThreadResizer.ShortStateSummary);
     var result = MultiThreadResizer.ShortStateSummary;
     var task = MultiThreadResizer.StartResizingTask(60);
     task.Wait();
     Assert.AreEqual(MultiThreadResizer.ShortStateSummary, GetFakeShortSummary(6, 6, 0, 0, 6, 0));
 }
 public void SetFolderWithImages()
 {
     var MultiThreadResizer = new MultiThreadResizerWorker();
     Assert.AreEqual(string.Concat("Added ", MultiThreadResizer.ListOfResizeSettingsDefault.Count* CountFiles, " FileAndCustomResizeSettings"), MultiThreadResizer.SetFolderWithImages(Path));
 }