Example #1
0
        public IThread Create(IScheduler scheduler, IScenarioHandler handler, IDataCollector collector)
        {
            IWork   scenarioWork = new ScenarioWork(scheduler, handler, collector);
            IThread thread       = new WorkerThread(scenarioWork, _prewait);

            _errorHandler.Register(thread);

            return(thread);
        }
Example #2
0
    public void TestSaveJson()
    {
        var testData = new PAData
        {
            One = 11,
            Two = 12
        };

        _scenarioHandler = new NewtonsoftScenarioHandler();
        _scenarioHandler.Save("scenario", testData);
    }
Example #3
0
 public Lobby(IGameHandler gameHandler,
              IRegistrationHandler registrationHandler,
              IUserHandler userHandler,
              IMappingHandler mappingHandler,
              IScenarioHandler scenarioHandler)
 {
     this.gameHandler         = gameHandler;
     this.registrationHandler = registrationHandler;
     this.userHandler         = userHandler;
     this.mappingHandler      = mappingHandler;
     this.scenarioHandler     = scenarioHandler;
 }
Example #4
0
 public Lobby( IGameHandler gameHandler,
               IRegistrationHandler registrationHandler,
               IUserHandler userHandler,
               IMappingHandler mappingHandler,
               IScenarioHandler scenarioHandler )
 {
     this.gameHandler = gameHandler;
     this.registrationHandler = registrationHandler;
     this.userHandler = userHandler;
     this.mappingHandler = mappingHandler;
     this.scenarioHandler = scenarioHandler;
 }
    public static void Init()
    {
        SaveWindowPA window = (SaveWindowPA)EditorWindow.GetWindow(typeof(SaveWindowPA));

        _scenarioHandler = new NewtonsoftScenarioHandler();

        int x = (Screen.currentResolution.width - SaveWindowPA.WindowWidth) / 2;
        int y = (Screen.currentResolution.height - SaveWindowPA.WindowHeight) / 2;

        window.position = new Rect(x, y,
                                   SaveWindowPA.WindowWidth,
                                   SaveWindowPA.WindowHeight);
        window.Show();
    }
        public IThread Create()
        {
            IIterationControl iterationContext = _iterationContextFactory.Create();

            // IScenario handler
            IScenarioHandler scenarioHandler = _scenarioHandlerFactory.Create(iterationContext);
            // Scheduler which will Sleep() thread if it needs to wait due to speed limiting strategy.
            IScheduler scheduler = _schedulerFactory.Create(iterationContext);
            // Data collector for results aggregation
            IDataCollector collector = _dataCollectorFactory.Create(iterationContext);

            IThread thread = _threadFactory.Create(scheduler, scenarioHandler, collector);

            return(thread);
        }
Example #7
0
        public ScenarioWork(IScheduler scheduler, IScenarioHandler handler, IDataCollector collector)
        {
            if (scheduler == null)
            {
                throw new ArgumentNullException(nameof(scheduler));
            }
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            _scheduler = scheduler;
            _handler   = handler;
            _collector = collector;
        }
Example #8
0
        public void RegisterTestServer <TStartupClass>(
            Action <IServiceCollection> dependencyInjectionConfiguration = null,
            IConfiguration applicationConfiguration = null, IScenarioHandler scenarioHandler = null) where TStartupClass : class
        {
            TestServer = new HostBuilder().ConfigureWebHostDefaults(builder =>
            {
                builder.UseStartup <TStartupClass>();
                builder.UseUrls($"http://0.0.0.0:{_testSeverPort}");

                if (dependencyInjectionConfiguration != null)
                {
                    builder.ConfigureServices(dependencyInjectionConfiguration);
                }

                if (applicationConfiguration != null)
                {
                    builder.UseConfiguration(applicationConfiguration);
                }
            });
            _contractDefinitionVerifier.ScenarioHandler = scenarioHandler;
        }
Example #9
0
 public void TestLoadJson()
 {
     _scenarioHandler = new NewtonsoftScenarioHandler();
     var testData = _scenarioHandler.Load <PAData>("scenario");
 }