Exemple #1
0
        private static void Run(Options opt)
        {
            var startup = new Startup(
                new FileWrapper()
                );

            var filePath = startup.GetPathInProject(opt.FileName);

            IBlobCounterWrapper        blobCounterWrapper        = new BlobCounterWrapper();
            ISimpleShapeCheckerWrapper simpleShapeCheckerWrapper = new SimpleShapeCheckerWrapper();
            IColorFilteringWrapper     colorFilteringWrapper     = new ColorFilteringWrapper();
            IPostItAnalysis            postItAnalysis            = new PostItAnalysis(blobCounterWrapper, simpleShapeCheckerWrapper, colorFilteringWrapper);
            ICountByColor countByColor = new CountByColor(postItAnalysis);

            try
            {
                if (startup.VerifyFile(filePath))
                {
                    var resultsGetter = new ResultsGetter(countByColor);
                    var result        = resultsGetter.Get(filePath);

                    var resultsPrinter = new ResultsPrinter();
                    resultsPrinter.Print(result);
                }
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #2
0
        protected Lottery(string url, string fileName, int bids, int totalNumbers)
        {
            var resultGetter = new ResultsGetter(url, fileName, bids);

            _mininumBids  = bids;
            _totalNumbers = totalNumbers;

            Sorteios = resultGetter.GetResults();
            PrepareLottery();
        }
        public void GetReturnsDictionary()
        {
            //Arrange
            _mockCountByColor = Substitute.For <ICountByColor>();
            var resultsGetter = new ResultsGetter(_mockCountByColor);
            var filename      = "filename.jpg";
            var expected      = new Dictionary <string, int>();

            _mockCountByColor.CountAllColors(filename).Returns(expected);

            //Act
            var actual = resultsGetter.Get(filename);

            //Assert
            Assert.AreEqual(expected, actual);
        }