public void WhenPublishing_WillSendATokenRequestToServer() { Client.Channels.Get("test").PublishAsync("test", "true"); ExecutionCount.Should().Be(1); TokenRequestCount.Should().Be(0); }
public void Execute() { keepRunning = true; Status = "Active"; this.Invoke((MethodInvoker)(() => lbStatus.Text = "Status: Running...")); this.Invoke((MethodInvoker)(() => this.BackColor = Color.Red)); //set GreenC5 property //InternalDataStructure = new GreenC5<string>(); InternalDataStructure.PropertyChanged += InternalDataStructure_PropertyChanged; InternalDataStructure.RunMode = RunMode; InternalDataStructure.InterfaceAndSetBagProperty = CurrentDataStructureGroup; InternalDataStructure.CurrentDataStructure = CurrentC5DataStructure; InternalDataStructure.SetDecisionMakingCriteria(K1, K2); InternalDataStructure.CreateNewInstanceOfInternalC5DataStructure(CurrentC5DataStructure); InternalDataStructure.TransformationCount = 0; InternalDataStructure.PredictionResultMessage = "N/a"; this.Invoke((MethodInvoker)(() => lbCurrentDataStructure.Text = "Current Data Structure: " + InternalDataStructure.CurrentDataStructure.ToString())); this.Invoke((MethodInvoker)(() => lbTransCount.Text = "Transform Count: " + InternalDataStructure.TransformationCount)); this.Invoke((MethodInvoker)(() => lbNumExecution.Text = "#Exec: 0")); int targetInd = 0; ExecutionCount = 0; do { foreach (string[] workload in rawCRUDArrayRows) { for (int i = 0; i < workload.Length; i++) { string op = workload[i].Trim(); //perform CRUD operations if (op == "C") { bool t = InternalDataStructure.Create(testString + targetInd); targetInd++; } else if (op == "R") { string item = testString + targetInd; //this always find last item string t = InternalDataStructure.Retrieve(item); } else if (op == "U") { bool t = InternalDataStructure.Update(testString + targetInd); } else if (op == "D") { bool t = InternalDataStructure.Delete(testString + targetInd); if (targetInd > 0) { targetInd--; } } if (!keepRunning) { break; } } } ExecutionCount++; InternalDataStructure.Clear();//clear everytime after each program execution this.Invoke((MethodInvoker)(() => lbNumExecution.Text = "#Exec: " + ExecutionCount.ToString())); if (!keepRunning) { break; } }while (IsInfiniteMode); this.Invoke((MethodInvoker)(() => this.BackColor = Color.LimeGreen)); this.Invoke((MethodInvoker)(() => lbStatus.Text = "Status: Idle")); Status = "Idle"; }