コード例 #1
0
ファイル: IntelDataTest.cs プロジェクト: spzenk/sfdocsamples
 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
ファイル: IntelService.cs プロジェクト: spzenk/sfdocsamples
        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
ファイル: IntelService.cs プロジェクト: Br3nda/sfdocsamples
        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
ファイル: IntelService.cs プロジェクト: spzenk/sfdocsamples
 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
ファイル: IntelService.cs プロジェクト: Br3nda/sfdocsamples
 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
ファイル: IntelClient.cs プロジェクト: spzenk/sfdocsamples
        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);
        }