public void IntelDataConstructorTest() { string agent = "agent"; Bitmap image = new Bitmap(100, 100); string caption = "caption"; IntelData target = new IntelData(agent, image, caption); Assert.AreEqual<string>(agent, target.Agent); Assert.AreEqual<Bitmap>(image, target.Image); Assert.AreEqual<string>(caption, target.Caption); }
public IntelEventArgs(IntelData intelData) { if (intelData.Image == null) throw new ArgumentException("Image cannot be null", "image"); if (string.IsNullOrEmpty(intelData.Agent)) throw new ArgumentException("Agent cannot be null or empty", "agent"); this.AgentProfile = new AgentProfile(intelData.Agent); this.Image = intelData.Image; this.Caption = intelData.Caption; this.EventType = IntelEventType.IntelReceived; }
public IntelEventArgs(IntelData intelData) { if (intelData.Image == null) { throw new ArgumentException("Image cannot be null", "image"); } if (string.IsNullOrEmpty(intelData.Agent)) { throw new ArgumentException("Agent cannot be null or empty", "agent"); } this.AgentProfile = new AgentProfile(intelData.Agent); this.Image = intelData.Image; this.Caption = intelData.Caption; this.EventType = IntelEventType.IntelReceived; }
public void SendIntel(IntelData intelData) { OnIntelRecevied(new IntelEventArgs(intelData)); }
private void SendIntel() { IntelData data = new IntelData(); data.Agent = this.Agent; data.Caption = this.Caption; data.Image = this.RawImage; _intelClient.SendIntel(data); }
public void SendItel_IntelReceivedEvent_Returns_Correct_IntelEventArg() { string agent = "agent"; string caption = "caption"; Bitmap image = new Bitmap(100, 100); IntelEventArgs args = null; _target.IntelReceived += new System.EventHandler<IntelEventArgs>((o, e) => { args = e; }); IntelData data = new IntelData(agent, image, caption); _target.SendIntel(data); Assert.AreEqual<string>(agent, args.AgentProfile.Agent); Assert.AreEqual<Bitmap>(image, args.Image); Assert.AreEqual<string>(caption, args.Caption); Assert.AreEqual<IntelEventType>(IntelEventType.IntelReceived, args.EventType); }
public void SendItel_Fires_IntelReceivedEvent() { string agent = "agent"; string caption = "caption"; Bitmap image = new Bitmap(100, 100); bool result = false; _target.IntelReceived += new System.EventHandler<IntelEventArgs>((o, e) => { result = true; }); IntelData data = new IntelData(agent,image,caption); _target.SendIntel(data); Assert.IsTrue(result); }
public void SendIntel(IntelData intelData) { if (intelData == null) throw new ArgumentException("IntelData cannot be null."); if (intelData.Image == null) throw new ArgumentException("IntelData.Image cannot be null."); intelData.Agent = this.Agent; IntelServiceProxy.SendIntel(intelData); }