示例#1
0
        public SimulatorConfigViewModel(RaceClockSimulation raceClockSimulation)
        {
            this.ContinueToSimulationCommand = new AsyncDelegateCommand(
                this.ContinueToSensorSimulation);

            this.raceClockSimulation = raceClockSimulation ?? throw new ArgumentNullException(nameof(raceClockSimulation));

            this.MaxSensorIdValue           = this.raceClockSimulation.MaxSensorIdValue;
            this.TimerIntervalMean          = this.raceClockSimulation.TimerIntervalMean;
            this.TimerIntervalStdDev        = this.raceClockSimulation.TimerIntervalStdDev;
            this.TimerFailureChance         = this.raceClockSimulation.TimerFailureChance;
            this.UnwantedTimerTriggerChance = this.raceClockSimulation.UnwantedTimerTriggerChance;
        }
        public void TestTimingTriggered()
        {
            var counter = 0;

            var simulation = new RaceClockSimulation
            {
                UnwantedTimerTriggerChance = 0,
                TimerIntervalMean          = 50,
                TimerIntervalStdDev        = 0,
                TimerFailureChance         = 0
            };

            simulation.TimingTriggered += (sensorId, time) => counter++;

            Thread.Sleep(140);

            Assert.Equal(2, counter);
        }
示例#3
0
 public SimulatorConfigWindow(RaceClockSimulation simulation)
 {
     InitializeComponent();
     this.DataContext = new ViewModels.SimulatorConfigViewModel(simulation);
 }