public QuoteSimulatorSupport(ProviderSimulatorSupport providerSimulator, ushort quotesPort, MessageFactory _quoteMessageFactory) { log.Register(this); this.providerSimulator = providerSimulator; this.quotesPort = quotesPort; this._quoteMessageFactory = _quoteMessageFactory; }
public FIXSimulatorSupport(string mode, ProjectProperties projectProperties, ProviderSimulatorSupport providerSimulator, ushort fixPort, MessageFactory createMessageFactory) { this.fixPort = fixPort; this.providerSimulator = providerSimulator; var randomSeed = new Random().Next(int.MaxValue); if (heartbeatDelay > 1) { log.Error("Heartbeat delay is " + heartbeatDelay); } if (randomSeed != 1234) { Console.WriteLine("Random seed for fix simulator:" + randomSeed); log.Info("Random seed for fix simulator:" + randomSeed); } random = new Random(randomSeed); log.Register(this); switch (mode) { case "PlayBack": break; default: break; } allTests = projectProperties.Simulator.EnableNegativeTests; foreach (SimulatorType simulatorType in Enum.GetValues(typeof(SimulatorType))) { var simulator = new SimulatorInfo(simulatorType, random, () => ProviderSimulator.Count); simulator.Enabled = false; simulator.MaxFailures = maxFailures; simulators.Add(simulatorType, simulator); } simulators[SimulatorType.BlackHole].Enabled = allTests; // Passed individually. simulators[SimulatorType.CancelBlackHole].Enabled = allTests; // Passed individually. simulators[SimulatorType.RejectSymbol].Enabled = allTests; // Passed individually. simulators[SimulatorType.RejectAll].Enabled = false; simulateReceiveFailed = allTests; // Passed individually. simulateSendFailed = allTests; // Passed individually. simulators[SimulatorType.SendServerOffline].Enabled = allTests; // Passed individually. simulators[SimulatorType.ReceiveServerOffline].Enabled = allTests; // Passed individually. simulators[SimulatorType.ServerOfflineReject].Enabled = allTests; // Passed individually. simulators[SimulatorType.SendDisconnect].Enabled = allTests; // Passed individually. simulators[SimulatorType.ReceiveDisconnect].Enabled = allTests; // Passed individually. simulators[SimulatorType.SystemOffline].Enabled = allTests; // Passed individually. { simulators[SimulatorType.ReceiveServerOffline].Frequency = 10; simulators[SimulatorType.SendServerOffline].Frequency = 20; simulators[SimulatorType.SendDisconnect].Frequency = 15; simulators[SimulatorType.ReceiveDisconnect].Frequency = 8; simulators[SimulatorType.CancelBlackHole].Frequency = 10; simulators[SimulatorType.BlackHole].Frequency = 10; simulators[SimulatorType.SystemOffline].Frequency = 10; simulators[SimulatorType.ServerOfflineReject].Frequency = 10; var simulator = simulators[SimulatorType.RejectSymbol]; simulator.Frequency = 10; simulator.MaxRepetitions = 1; } foreach (var kvp in projectProperties.Simulator.NegativeSimulatorMinimums) { var type = kvp.Key; var minimum = kvp.Value; if (minimum == 0) { simulators[type].Minimum = minimum; simulators[type].Enabled = false; } else { simulators[type].Minimum = minimum; } } this.currentMessageFactory = createMessageFactory; }