Пример #1
0
 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);
 }
Пример #2
0
        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;
        }
Пример #3
0
        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;
        }
Пример #4
0
 public void SendIntel(IntelData intelData)
 {
     OnIntelRecevied(new IntelEventArgs(intelData));
 }     
Пример #5
0
        private void SendIntel()
        {
            IntelData data = new IntelData();
            data.Agent = this.Agent;
            data.Caption = this.Caption;
            data.Image = this.RawImage;

            _intelClient.SendIntel(data);
        }
Пример #6
0
 public void SendIntel(IntelData intelData)
 {
     OnIntelRecevied(new IntelEventArgs(intelData));
 }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }
Пример #9
0
        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);
        }