Esempio n. 1
0
        public void IncorrectArgumentImageSelection()
        {
            var histogramService     = new HistogramSorterService();
            var pathToHistogramFiles = $"{Directory.GetCurrentDirectory()}/../../../{TestFilesFolder}";
            var colorHistograms      = histogramService.ParseHistograms(pathToHistogramFiles);

            try
            {
                histogramService.SelectRandomImages(NumberOfTestImagesForArgumentExc, colorHistograms);
            }
            catch (ArgumentException)
            {
                Assert.True(true);
            }
            catch (Exception)
            {
                Assert.True(false);
            }
        }
Esempio n. 2
0
        public void CorrectImageSelection()
        {
            var histogramService     = new HistogramSorterService();
            var pathToHistogramFiles = $"{Directory.GetCurrentDirectory()}/../../../{TestFilesFolder}";
            var colorHistograms      = histogramService.ParseHistograms(pathToHistogramFiles);

            var presentedImages =
                histogramService.SelectRandomImages(NumberOfImagesToPresent, colorHistograms);

            Assert.True(presentedImages.Count == NumberOfImagesToPresent);
            for (var i = presentedImages.Count - 1; i >= 0; i--)
            {
                for (var j = i - 1; j >= 0; j--)
                {
                    Assert.True(
                        presentedImages[i].ImageId != presentedImages[j].ImageId,
                        $"{presentedImages[i].ImageId} matches {presentedImages[j].ImageId}"
                        );
                }
                presentedImages.RemoveAt(i);
            }
        }