예제 #1
0
        public ScenarioScheduler()
        {
            Schedule(() =>
            {
                using (var dataContext = new DataContext())
                {
                    try
                    {
                        IScenarioService scenarioService   = new ScenarioService(dataContext);
                        IOutputConfigService outputService = new OutputConfigService(dataContext);
                        var scenarios = scenarioService.GetScenarios(new GetScenariosRequest {
                            Take = 0
                        }).Scenarios;
                        //var outputResults = new List<CalculateOutputResponse>();
                        foreach (var scenario in scenarios)
                        {
                            var outputResult = outputService.CalculateOputput(new CalculateOutputRequest {
                                ScenarioId = scenario.Id
                            });
                            SerializationHelper.SerializeObject <CalculateOutputResponse>(outputResult, "output-scenario-" + scenario.Id);
                        }
                    }
                    catch
                    {
                        //logging here
                    }
                }
            }).ToRunEvery(1).Months().OnTheFirst(DayOfWeek.Monday).At(0, 0);


            //
        }
예제 #2
0
        public void Should_return_scenarios()
        {
            // Arrange
            IScenarioService scenarioService = new ScenarioService(_mockDataSettings.Object, _mockScenarioRepository.Object);

            // Act
            var scenarios = scenarioService.GetScenarios();

            // Assert
            scenarios.Should().NotBeEmpty();
            scenarios.Count().Should().Be(6);
        }