Ejemplo n.º 1
0
        public void FilesProcessing()
        {
            string[] fileNames = Directory.GetFiles(Constants.DataFilesFolder);

            var recordCollector = RecordCollector.GetInstance();

            foreach (var fileName in fileNames)
            {
                using (container = new UnityContainer())
                {
                    var menuConfiguration = new MenuConfiguration(container);
                    menuConfiguration.Configure();

                    var menu = container.Resolve <IMenu>();

                    var configurator = new ReportConfigurator(container, fileName, menu);

                    configurator.Setup();

                    if (configurator.IsSuccesfulConfiguration)
                    {
                        var record = new OfficerProcessingRecord();

                        record.FileName = fileName;

                        recordCollector.AddRecord(record);

                        Run();
                    }
                }
            }
            recordCollector.WriteRecordList();
        }
Ejemplo n.º 2
0
        public void ReportConfigurator_ConstructorParametersAreNotNullReturnsReportConfiguration()
        {
            IUnityContainer fakeUnityContainer = NSubstitute.Substitute.For <IUnityContainer>();

            string fakeFileName = "fakeFileName";

            IMenu fakeMenu = NSubstitute.Substitute.For <IMenu>();

            var reportConfigurator = new ReportConfigurator(fakeUnityContainer, fakeFileName, fakeMenu);

            Assert.NotNull(reportConfigurator);
        }
Ejemplo n.º 3
0
        public void ReportConfigurator_Setup_CheckDataAccessInContainer()
        {
            IUnityContainer fakeUnityContainer = new UnityContainer();

            string fakeFileName = "helloen.csv";

            int fakeFormattedNumber = 1;

            IMenu fakeMenu = new FakeMenu(fakeFormattedNumber);

            var reportConfigurator = new ReportConfigurator(fakeUnityContainer, fakeFileName, fakeMenu);

            reportConfigurator.Setup();

            var numberOfRegistration = fakeUnityContainer.Registrations.Where(x => x.RegisteredType == typeof(ICommonDataAccess)).Count();

            var expectedNumberOfRegistrations = 1;

            Assert.Equal(expectedNumberOfRegistrations, numberOfRegistration);
        }