Exemple #1
0
        public void OneTimeSetUp()
        {
            _log = new Mock <ILog>().Object;
            var hostingEnvMock = new Mock <IHostingEnvironment>();

            hostingEnvMock.Setup(x => x.ContentRootPath).Returns("../../../../../src/MarginTrading.NotificationGenerator/");

            var builder = new ContainerBuilder();

            var fakeSettings = new NotificationGeneratorSettings
            {
                MonthlyTradingReportSettings = new NotificationsSettings
                {
                    EmailNotificationEnabled = true,
                    Filter = new TradingReportFilter {
                        LegalEntityRegex = "^LYKKECY$"
                    },
                    InvocationTime = new TimeSpan(0, 0, 0),
                }
            };

            builder.RegisterModule(new JobModule(new StaticSettingsManager <NotificationGeneratorSettings>(fakeSettings),
                                                 _log, hostingEnvMock.Object));
            var externalMockModule = new ExternalServiceMockModule(_log);

            EmailSenderMock = externalMockModule.EmailSenderMock;
            builder.RegisterModule(externalMockModule);

            Container = builder.Build();

            TradingReportService = Container.Resolve <ITradingReportService>();
        }
Exemple #2
0
        public ExternalServicesModule(NotificationGeneratorSettings settings, ILog log,
                                      IHostingEnvironment environment)
        {
            _log         = log;
            _environment = environment;
            _settings    = settings;

            _services = new ServiceCollection();
        }
Exemple #3
0
        public JobModule(IReloadingManager <NotificationGeneratorSettings> settings, ILog log, IHostingEnvironment environment)
        {
            _log         = log;
            _environment = environment;
            _settings    = settings.CurrentValue;
            _settingsReloadingManager = settings;

            _services = new ServiceCollection();
        }