예제 #1
0
        public static void AfterScenario(ITestOutcomeEvent e)
        {
            var specflowContext = SpecflowContextWrapper.Create();
            var scenario        = ScenarioService.GetScenario(e, specflowContext);

            FeatureService.RegisterScenario(scenario, specflowContext);
        }
예제 #2
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);


            //
        }
예제 #3
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         throw new System.Exception($"Too many {this} instances");
     }
 }
예제 #4
0
        public void Should_retrun_null_when_getscenariobyuserid_called_and_userid_not_exists(string userId)
        {
            // Arrange
            IScenarioService scenarioService = new ScenarioService(_mockDataSettings.Object, _mockScenarioRepository.Object);

            // Act
            var scenario = scenarioService.GetScenarioByUserId(userId)
            ;

            // Assert
            scenario.Should().BeNull();
        }
예제 #5
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);
        }
예제 #6
0
        public void Should_fetch_scenario_when_getscenariobyid_called_and_scenarioid_exists(long scenarioId, long expectedId)
        {
            // Arrange
            IScenarioService scenarioService = new ScenarioService(_mockDataSettings.Object, _mockScenarioRepository.Object);

            // Act
            var scenario = scenarioService.GetScenarioById(scenarioId)
            ;

            // Assert
            scenario.ScenarioID.Should().Be(expectedId);
            scenario.Should().NotBeNull();
        }
예제 #7
0
        public void Should_fetch_scenario_when_getscenariobyuserid_called_and_userid_exists(string userId, string expectedResult)
        {
            // Arrange
            IScenarioService scenarioService = new ScenarioService(_mockDataSettings.Object, _mockScenarioRepository.Object);

            // Act
            var scenario = scenarioService.GetScenarioByUserId(userId)
            ;

            // Assert
            scenario.UserID.Should().Be(expectedResult);
            scenario.Should().NotBeNull();
        }
예제 #8
0
        public void Should_fetch_scenarios_for_given_creation_date_range()
        {
            // Arrange
            IScenarioService scenarioService = new ScenarioService(_mockDataSettings.Object, _mockScenarioRepository.Object);
            var dateFrom = DateTime.Now.AddDays(-1);
            var dateTo   = DateTime.Now;

            // Act
            var scenarios = scenarioService.GetScenariosByCreationDateRange(dateFrom, dateTo)
            ;

            // Assert
            scenarios.Should().NotBeEmpty();
            scenarios.Count().Should().Be(3);
        }
예제 #9
0
        private void CreateSceneModel()
        {
            ScenarioService service = Service.Instance.Services[Service.Type.Scenario] as ScenarioService;

            ScenarioSceneDataModel[] data = service.LoadScenesData();
            scenes = new ScenarioSceneModel[data.Length];

            for (int i = 0; i < scenes.Length; i++)
            {
                ScenarioSceneModel scene = new ScenarioSceneModel();
                scene.Name = data[i].Name;
                scene.Line = data[i].Line;
                scene.Bg   = Resources.Load <Sprite>(data[i].BgPath);
                scenes[i]  = scene;
            }
        }
예제 #10
0
        static void Main(string[] args)
        {
            var productRepo     = new ProductRepository();
            var cardRepo        = new CardRepository(productRepo);
            var scenarioService = new ScenarioService(productRepo, cardRepo);

            Console.WriteLine("Scenario Builder");

            foreach (var g in scenarioService.ScenarioGroups())
            {
                Console.WriteLine("Scenario Group: " + g.Name);
                foreach (var s in g.Scenarios)
                {
                    var slug     = getScenarioSlug(s);
                    var fileName = slug + ".cs";
                    Console.WriteLine(string.Format("  {0} ({1})", s.Title, fileName));
                    var text = getScenarioText(s, slug);
                    System.IO.File.WriteAllText(fileName, text);
                }
            }

            Console.WriteLine("DONE");
            Console.ReadLine();
        }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScenarioController"/> class.
 /// </summary>
 public ScenarioController()
 {
     _scenarioService = new ScenarioService();
 }
예제 #12
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

            System.Web.HttpContext.Current.Application.Lock();

            var productRepository = new ProductRepository();

            System.Web.HttpContext.Current.Application[Extensions.ProductRepositoryKey] = productRepository;

            var cardRepository = new CardRepository(productRepository);

            System.Web.HttpContext.Current.Application[Extensions.CardRepositoryKey] = cardRepository;

            var categoryService = new CategoryService(cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.CategoryServiceKey] = categoryService;

            var scenarioService = new ScenarioService(productRepository, cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.ScenarioServiceKey] = scenarioService;

            var ringsDbService = new RingsDbService(cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.RingsDbKey] = ringsDbService;

            var advancedSearchService = new AdvancedSearchService();
            var sortService           = new SearchSortService(ringsDbService);

            var noteService = new NoteService();

            System.Web.HttpContext.Current.Application[Extensions.NoteServiceKey] = noteService;

            var searchService = new SearchService(productRepository, cardRepository, scenarioService, advancedSearchService, sortService, ringsDbService, noteService);

            System.Web.HttpContext.Current.Application[Extensions.SearchServiceKey] = searchService;

            var statService = new StatService(cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.StatServiceKey] = statService;

            var octgnService = new OctgnService(productRepository, cardRepository);

            System.Web.HttpContext.Current.Application[Extensions.OctgnServiceKey] = octgnService;

            var templateService = new TemplateService();

            System.Web.HttpContext.Current.Application[Extensions.TemplateServiceKey] = templateService;

            var tagService = new TagService();

            System.Web.HttpContext.Current.Application[Extensions.TagServiceKey] = tagService;

            System.Web.HttpContext.Current.Application.UnLock();
        }
예제 #13
0
 public void Setup()
 {
     scenarioService = new ScenarioService();
 }
 public Worker(ILogger <Worker> logger, ScenarioService scenarioService)
 {
     _logger          = logger;
     _scenarioService = scenarioService;
 }