public void Should_Execute_Plugin() { IBroker broker = new Broker(); IAgentEngine agent = new AgentEngine( ); IAllocationDefinition definition = new AllocationDefinition(2); IExecutionSlot slot = new ExecutionSlot(definition); broker.Add(agent); agent.PluginManager.Install(definition); agent.ExecutionManager.Add( slot ); definition.Add(DTO.NewPluginInfoTestPlugin); IPlugin completedPlugin = null; TestPlugin testPlugin = new TestPlugin(100); broker.ExecuteCompleted += delegate(object sender, ObjectEventArgs<IPlugin> eventArgs) { completedPlugin = eventArgs.EventObject; }; broker.Execute(testPlugin); Assert.AreEqual(slot, agent.ExecutionManager[definition]); Assert.AreEqual(1, agent.ExecutionManager[definition].UsedSlots, "Slots Used"); Timing.WaitWhile(() => completedPlugin == null, 1000); Assert.AreEqual(testPlugin, completedPlugin); Assert.AreEqual(0, agent.ExecutionManager[definition].UsedSlots); Assert.AreEqual(PluginStatus.Executed, testPlugin.Status); }
// POST: api/BrokerBlockView public void Post(List <Block> obj) { Broker <Block> br = new Broker <Block>(context); for (int i = 0; i < obj.Count; i++) { br.Add(obj[i]); } }
public void Should_Add_LocalAgent() { IBroker broker = new Broker(); IAgent agent = new AgentEngine( ); int count = 0; broker.Add( agent ); foreach( IAgent enumerable in broker.Agents ) count++; Assert.AreEqual(1, count); }
protected void Button1_Click(object sender, EventArgs e) { if (sepet.Count != 0) { foreach (Cart c in sepet) { b.Add(c); } sepet.Clear(); handleTable(); Table1.Visible = false; Label1.Text = "Bizimle alışveriş yaptığınız için teşekkür ederiz!"; } else { Label1.Visible = true; Label1.Text = "Sepette ürün bulunmamaktadır."; } }
protected void ekle_telefon_Click(object sender, EventArgs e) { if (Page.IsValid) { status.Visible = true; Phone p = new Phone(); p.Brand = ekle_firma.SelectedValue.ToString(); p.Description = ekle_desc.Text; p.Length = Convert.ToDouble(ekle_length.Text); p.Memory = Convert.ToInt32(ekle_boyut.SelectedValue.ToString().Remove(ekle_boyut.SelectedValue.ToString().Length - 2)); p.Name = ekle_isim.Text; p.Os = ekle_os.SelectedValue.ToString(); p.Price = Convert.ToDouble(ekle_fiyat.Text); b.Add(p); status.Visible = true; status.Text = p.Brand + " " + p.Name + " basariyla eklendi!"; } }
private void SaveState(decimal price, DateTime date) { _exchange.SaveState(_stockName, price, date); _broker.Add(_exchange.GetState()); }
public void Add(IEntity entity) { broker.Add(entity); }
// POST: api/Security public void Post(BrokerSecurity brData) { IBroker <BrokerSecurity> b = new Broker <BrokerSecurity>(context); b.Add(brData); }
public void Should_Throw_Exception_When_Plugin_Isnt_Installed_When_Rollback() { IBroker broker = new Broker(); IAgentEngine agent = new AgentEngine(); IAllocationDefinition definition = new AllocationDefinition(2); IExecutionSlot slot = new ExecutionSlot(definition); broker.Add(agent); agent.PluginManager.Install(definition); agent.ExecutionManager.Add(slot); TestPlugin testPlugin = new TestPlugin(); broker.Rollback(testPlugin); }
public void Should_Throw_Exception_When_No_Slots_Are_Available_For_Rollback() { IBroker broker = new Broker(); IAgentEngine agent = new AgentEngine(); IAllocationDefinition definition = new AllocationDefinition(2); IExecutionSlot slot = new ExecutionSlot(definition); broker.Add(agent); definition.Add(DTO.NewPluginInfoTestPlugin); agent.PluginManager.Install(definition); agent.ExecutionManager.Add(slot); broker.Rollback(new TestPlugin(600)); broker.Rollback(new TestPlugin(600)); broker.Rollback(new TestPlugin(600)); }