Exemplo n.º 1
0
        static void Main(string[] args)
        {
            string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Official_Copy_Register_EGL363613.pdf");

            Stopwatch stopWatch = Stopwatch.StartNew();

            // Configuration allows swapping out implementations of parts of the system
            IConfigurationFacade configuration = new ConfigurationFacade()
            {
                RuleEngine           = new DefaultDataColumnRuleEngine(),
                NoteExtractor        = new DefaultNoteExtractor(),
                WhiteSpaceCalculator = new DefaultWhiteSpaceSizeCalculator()
            };

            ScheduleController controller = new ScheduleController(configuration);

            controller.LoadData(new PdfReader(filePath));
            controller.CreateScheduleEntries();

            stopWatch.Stop();

            // Reporting

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine($"Processed { controller.ScheduleEntries.Count() } entries in { stopWatch.ElapsedMilliseconds }ms");

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine($"Total Valid Entries: { controller.ScheduleEntries.Where(e => e.IsValid).Count() }");

            int invalidEntryCount = controller.ScheduleEntries.Where(e => !e.IsValid).Count();

            if (invalidEntryCount > 0)
            {
                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine($"Total Invalid Entries: { invalidEntryCount }");

                Console.WriteLine();
                Console.WriteLine("===============");
                Console.WriteLine("Invalid Entries");
                Console.WriteLine("===============");
                Console.WriteLine();

                foreach (var scheduleEntry in controller.ScheduleEntries.Where(e => !e.IsValid))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    foreach (var text in scheduleEntry.EntryText)
                    {
                        Console.WriteLine(text);
                    }

                    Console.WriteLine();
                }
            }

            Console.ReadLine();
        }
Exemplo n.º 2
0
        public void EstatisticasPorEstadosRetornaEstados()
        {
            IEstatisticasAppService appService = new EstatisticasAppService(
                _mockUnityOfWork.Object,
                new AssertionConcern(new DomainNotificationContext()),
                new PosicaoRepository(new DatabaseContext(ConfigurationFacade.BuildConfiguraion())));

            IList <EstatisticasResultadosViewModel> resultado =
                appService.ObterEstatisticasPorEstado().GetAwaiter().GetResult();


            Assert.NotNull(resultado);
        }
        public TestFixture()
        {
            var builder = new ConfigurationBuilder()
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddUserSecrets <TestFixture>();

            IConfigurationRoot config = builder.Build();

            var services = new ServiceCollection();

            IFileProvider physicalFileProvider = new PhysicalFileProvider(Directory.GetCurrentDirectory());

            ConfigurationFacade.Configure(services, config, true, physicalFileProvider);

            ServiceProvider = services.BuildServiceProvider();
        }
        public void ConfigureServices()
        {
            if (_environment != Development)
            {
                _services.AddSingleton(new LoggerFactory()
                                       .AddConsole()
                                       .AddSerilog()
                                       .AddDebug());
                _services.AddLogging();
            }

            // configure automapper and setup dependency injection
            IFileProvider physicalFileProvider = new PhysicalFileProvider(Directory.GetCurrentDirectory());

            ConfigurationFacade.Configure(_services, _config, !_decryptSecrets, physicalFileProvider);
            ServiceProvider = _services.BuildServiceProvider();
        }