public NYBImport(INYBFileProcessUtility nybLoader, ILoggingHelper loggingHelper, IConfigurationHelper configurationHelper) { this.nybLoader = nybLoader; this.loggingHelper = loggingHelper; this.configurationHelper = configurationHelper; this.ServiceName = configurationHelper.ReadAppSettingsConfigurationValues(NYBLoaderConstants.BatchServiceName); this.strProcessedFilePath = configurationHelper.ReadAppSettingsConfigurationValues(NYBLoaderConstants.ProcessedFilePath); this.strErrorFilePath = configurationHelper.ReadAppSettingsConfigurationValues(NYBLoaderConstants.ErrorFilePath); }
/// <summary> /// The main entry point for the application. /// </summary> private static void Main() { IKernel kernel = new StandardKernel(new StartUp()); IConfigurationHelper configurationHelper = kernel.Get <IConfigurationHelper>(); ILoggingHelper loggingHelper = kernel.Get <ILoggingHelper>(); INYBFileProcessUtility nybLoader = kernel.Get <INYBFileProcessUtility>(); ServiceBase[] servicesToRun = new ServiceBase[] { new NYBImport(nybLoader, loggingHelper, configurationHelper) }; ServiceBase.Run(servicesToRun); }
protected override void OnSetup() { httpHandlerMock = CreateMock <IHttpHandler>(); configurationHelperMock = CreateMock <IConfigurationHelper>(); mockLoggingHelper = CreateMock <ILoggingHelper>(); mockExceptioHelper = CreateMock <IExceptionHelper>(); mockExceptioHelper.Setup(n => n.HandleException(It.IsAny <Exception>(), It.IsAny <ExceptionHandlingPolicy>())).Returns(true); configurationHelperMock.Setup(x => x.ReadAppSettingsConfigurationValues("ProcessedFilePath")).Returns("d:/processedfile/"); configurationHelperMock.Setup(x => x.ReadAppSettingsConfigurationValues("ErrorFilePath")).Returns("d:/errorfile/"); configurationHelperMock.Setup(x => x.ReadAppSettingsConfigurationValues("FMOWebAPIURL")).Returns("http://dunnyURl.com/"); configurationHelperMock.Setup(x => x.ReadAppSettingsConfigurationValues("FMOWebAPIName")).Returns("api/SaveDetails"); configurationHelperMock.Setup(x => x.ReadAppSettingsConfigurationValues(NYBLoaderConstants.NoOfCharactersForNYB)).Returns("15"); configurationHelperMock.Setup(x => x.ReadAppSettingsConfigurationValues(NYBLoaderConstants.CsvValuesForNYB)).Returns("16"); configurationHelperMock.Setup(x => x.ReadAppSettingsConfigurationValues(NYBLoaderConstants.MaxCharactersForNYB)).Returns("507"); testCandidate = new NYBFileProcessUtility(httpHandlerMock.Object, configurationHelperMock.Object, mockLoggingHelper.Object, mockExceptioHelper.Object); var rmTraceManagerMock = new Mock <IRMTraceManager>(); rmTraceManagerMock.Setup(x => x.StartTrace(It.IsAny <string>(), It.IsAny <Guid>())); mockLoggingHelper.Setup(x => x.RMTraceManager).Returns(rmTraceManagerMock.Object); }