public void RunTestsThread() { try { while (true) { lock (TimeoutOrders) { //1- Ok order DoLog(string.Format("Sending full regular order @{0}", Configuration.Name), Constants.MessageType.Information); Order fullOrder = OrderBuilder.BuildFullOrder(); NewOrderWrapper fullOrderWrapper = new NewOrderWrapper(fullOrder, Configuration); MessageOk.Add(fullOrder.ClOrdId, fullOrder); TimeoutOrders.Add(fullOrder.ClOrdId, DateTime.Now); ExecutionReportsReceived.Add(fullOrder.ClOrdId, 0); DoPublishMessage(fullOrderWrapper); } Thread.Sleep(2000); } } catch (Exception ex) { DoLog(string.Format("{0}-Critical error running tests:{1}", Configuration.Name, ex.Message), Constants.MessageType.Error); } }
public void RunTestsThread() { try { //1- Ok order DoLog(string.Format("Sending full regular order @{0}", Configuration.Name), Constants.MessageType.Information); Order fullOrder = OrderBuilder.BuildFullOrder(); NewOrderWrapper fullOrderWrapper = new NewOrderWrapper(fullOrder, Configuration); MessageOk.Add(fullOrder.ClOrdId, fullOrder); TimeoutOrders.Add(fullOrder.ClOrdId, DateTime.Now); DoPublishMessage(fullOrderWrapper); //2- Missing Mandatory tag test DoLog(string.Format("Sending missing tag order @{0}", Configuration.Name), Constants.MessageType.Information); Order missingTagOrder = OrderBuilder.BuildOrderMissingAccount(); NewOrderWrapper missingTagOrderWrapper = new NewOrderWrapper(missingTagOrder, Configuration); MissingTags.Add(missingTagOrder.ClOrdId, "1");//ClOrdId TimeoutOrders.Add(missingTagOrder.ClOrdId, DateTime.Now); DoPublishMessage(missingTagOrderWrapper); //3- Invalid Value tag test DoLog(string.Format("Sending invalid tag value @{0}", Configuration.Name), Constants.MessageType.Information); Order invalidValueOrder = OrderBuilder.BuildFullOrder(); invalidValueOrder.Side = Side.BuyToClose; NewOrderWrapper invalidValueOrderWrapper = new NewOrderWrapper(invalidValueOrder, Configuration); MissingTags.Add(invalidValueOrder.ClOrdId, "54");//Side TimeoutOrders.Add(invalidValueOrder.ClOrdId, DateTime.Now); DoPublishMessage(invalidValueOrderWrapper); } catch (Exception ex) { DoLog(string.Format("{0}-Critical error running tests:{1}", Configuration.Name, ex.Message), Constants.MessageType.Error); } }
//Here we will process the rejected messages and see if that's ok or not protected void ProcessReject(object param) { try { lock (TimeoutOrders) { Wrapper rejectWrapper = (Wrapper)param; string key = (string)rejectWrapper.GetField(RejectFields.KEY); string text = (string)rejectWrapper.GetField(RejectFields.Text); if (TimeoutOrders.ContainsKey(key)) { TimeoutOrders.Remove(key); } if (MessageOk.ContainsKey(key)) { string refTag = (string)rejectWrapper.GetField(RejectFields.RefTagID); //We expected the message to be ok but it was ejected DoLog(string.Format("<{0}>-Test case FAILED for Order ClOrdId = {1}. We expected the order to be ok but it was rejected. Reason={2} Tag={3}", Configuration.Name, key, text, refTag != null ? refTag : "??"), Constants.MessageType.AssertFailed); } if (MissingTags.ContainsKey(key)) { string refTag = (string)rejectWrapper.GetField(RejectFields.RefTagID); if (MissingTags[key] == refTag) { DoLog(string.Format("<{0}>-Test case OK for ClOrdId ={1}. Expected to have a message rejected for missing tag ={2} and it was rejected for that tag", Configuration.Name, key, refTag), Constants.MessageType.AssertOk); } else { DoLog(string.Format("<{0}>-Test case FAILED for ClOrdId ={1}. Expected to have a message rejected for missing tag ={2} but it was rejected for tag {3}", Configuration.Name, key, MissingTags[key], refTag), Constants.MessageType.AssertFailed); } } if (ExtraTags.ContainsKey(key)) { //Validar que el error es por Extra Tags } } } catch (Exception ex) { DoLog(string.Format("{0}-Critical error processing a reject:{1}", Configuration.Name, ex.Message), Constants.MessageType.Error); } }
public static DialogResult ShowMessage(string message, string caption, MessageBoxButtons button, MessageBoxIcon icon) { DialogResult dlgResult = DialogResult.None; switch (button) { case MessageBoxButtons.OK: using (MessageOk msgOK = new MessageOk()) { //Change text, caption, icon msgOK.Caption = caption; msgOK.Message = message; switch (icon) { case MessageBoxIcon.Information: msgOK.MessageIcon = WinForm.UI.Properties.Resources.information_ico; break; case MessageBoxIcon.Question: msgOK.MessageIcon = WinForm.UI.Properties.Resources.question_ico; break; } dlgResult = msgOK.ShowDialog(); } break; case MessageBoxButtons.YesNo: using (MessageYesNo msgYesNo = new MessageYesNo()) { msgYesNo.Caption = caption; msgYesNo.Message = message; switch (icon) { case MessageBoxIcon.Information: msgYesNo.MessageIcon = WinForm.UI.Properties.Resources.information_ico; break; case MessageBoxIcon.Question: msgYesNo.MessageIcon = WinForm.UI.Properties.Resources.question_ico; break; } dlgResult = msgYesNo.ShowDialog(); } break; } return(dlgResult); }
public void Start() { if (PlanetModifiers.Planets.Count == 0) { PlanetModifiers.init(); } playGameBtn = transform.Find("Play_Button").GetComponent <Button>(); playGameBtn.onClick.AddListener(PlayGame); backBtn = transform.Find("Back_Button").GetComponent <Button>(); backBtn.onClick.AddListener(Back); creatureName = transform.Find("Input_Name").GetComponent <InputField>(); messageBox = transform.Find("Message_Box").GetComponent <MessageOk>(); }
protected void ProcessExecutionReport(object param) { try { lock (TimeoutOrders) { Wrapper erWrapper = (Wrapper)param; string key = (string)erWrapper.GetField(ExecutionReportFields.KEY); if (TimeoutOrders.ContainsKey(key)) { TimeoutOrders.Remove(key); } if (MessageOk.ContainsKey(key)) { //We expected the message to be ok but it was ejected DoLog(string.Format("<{0}>-Test case OK for Order ClOrdId = {1}. We expected a valid ER and that was received.", Configuration.Name, key), Constants.MessageType.AssertOk); } if (MissingTags.ContainsKey(key)) { DoLog(string.Format("<{0}>-Test case FAILED for ClOrdId ={1}. Expected a missing tag {2} but received an Ok Execution Report", Configuration.Name, key, MissingTags[key]), Constants.MessageType.AssertFailed); } if (ExtraTags.ContainsKey(key)) { DoLog(string.Format("<{0}>-Test case FAILED for ClOrdId ={1}. Expected an extra tag {2} but received an Ok Execution Report", Configuration.Name, key, ExtraTags[key]), Constants.MessageType.AssertFailed); } } } catch (Exception ex) { DoLog(string.Format("{0}-Critical error processing a execution report:{1}", Configuration.Name, ex.Message), Constants.MessageType.Error); } }
protected void ProcessExecutionReport(object param) { try { lock (TimeoutOrders) { Wrapper erWrapper = (Wrapper)param; string key = (string)erWrapper.GetField(ExecutionReportFields.KEY); string orderId = (string)erWrapper.GetField(ExecutionReportFields.OrderID); string clOrderId = (string)erWrapper.GetField(ExecutionReportFields.ClOrdID); if (MessageOk.ContainsKey(key)) { ExecutionReportsReceived[key]++; if (ExecutionReportsReceived[key] == Configuration.ResponsesToArrive) { TimeoutOrders.Remove(key); DoLog(string.Format("<{0}>- Received {1} ERs with order id {2}", Configuration.Name, ExecutionReportsReceived[key], orderId), Constants.MessageType.AssertOk); } else if (ExecutionReportsReceived[key] > Configuration.ResponsesToArrive) { DoLog(string.Format("<{0}>- Received {1} ERs for ClOrdId {2}. This is more than expected (max {3})!!!!", Configuration.Name, ExecutionReportsReceived[key], clOrderId, Configuration.ResponsesToArrive), Constants.MessageType.AssertFailed); } } //This must be an order we don't manage or that we have already rejected so the counter is considered to be not working } } catch (Exception ex) { DoLog(string.Format("<{0}>-Critical error processing a execution report:{1}", Configuration.Name, ex.Message), Constants.MessageType.AssertFailed); } }
public void Start() { if (PlanetModifiers.Planets.Count == 0) { PlanetModifiers.init(); } planetDropDown = transform.Find("Planet_Dropdown").GetComponent <Dropdown>(); populateDropdown(); planetDropDown.onValueChanged.AddListener(delegate { changePlanetType(planetDropDown); }); playGameBtn = transform.Find("Next_Button").GetComponent <Button>(); genPlanetBtn = transform.Find("Refresh_Button").GetComponent <Button>(); playGameBtn.onClick.AddListener(PlayGame); genPlanetBtn.onClick.AddListener(GeneratePlanet); backBtn = transform.Find("Back_Button").GetComponent <Button>(); backBtn.onClick.AddListener(Back); planetName = transform.Find("Input_Name").GetComponent <InputField>(); scaleSlider = transform.Find("Scale_Slider").GetComponent <Slider>(); scaleSlider.value = PlanetInfo.info.planetScale; scaleSlider.onValueChanged.AddListener(delegate { valueChangeScale(); }); speedSlider = transform.Find("Speed_Slider").GetComponent <Slider>(); speedSlider.value = PlanetInfo.info.rotationSpeed; speedSlider.onValueChanged.AddListener(delegate { valueChangeSpeed(); }); messageBox = transform.Find("Message_Box").GetComponent <MessageOk>(); pt = transform.Find("Planet_Preview").GetComponentInChildren <PerlinNoiseTerrain>(); pb = transform.Find("Planet_Preview").GetComponentInChildren <PlanetBehaviour>(); }