Exemplo n.º 1
0
        public void OnAgentStatusChanged(object sender, IntelEventArgs args)
        {
            switch (args.EventType)
            {
                case IntelEventType.AgentEnter:
                    var offline = (from a in this.Agents where a.IsOnline == false select a).ToArray();

                    foreach (var a in offline)
                        this.Agents.Remove(a);

                    AgentViewModel agentViewModel = new AgentViewModel(args.AgentProfile);
                    agentViewModel.IsOnline = true;
                    this.Agents.Add(agentViewModel);
                    break;
                case IntelEventType.AgentLeave:
                    var agent = (from a in this.Agents where a.Agent == args.AgentProfile.Agent select a).First();
                    if (agent != null)
                        agent.IsOnline = false;            
                   
                    break;
            }
        }
Exemplo n.º 2
0
 public void Image_IsNotNull_When_AgentProfileImage_IsNull()
 {
     AgentProfile agentProfile = new AgentProfile("agent");
     AgentViewModel target = new AgentViewModel(agentProfile);
     Assert.IsNotNull(target.Image);
 }
Exemplo n.º 3
0
 public void IsOnline_IsFalse_At_Creation()
 {
     AgentProfile agentProfile = new AgentProfile("agent");
     AgentViewModel target = new AgentViewModel(agentProfile);
     Assert.IsFalse(target.IsOnline);
 }
Exemplo n.º 4
0
 public void Throw_Exception_With_EmpyAgent_In_AgentProfile()
 {
     AgentProfile profile = new AgentProfile(string.Empty);
     AgentViewModel target = new AgentViewModel(profile);
 }
Exemplo n.º 5
0
 public void Throw_Excpetion_With_NullAgentProfile()
 {
     AgentViewModel target = new AgentViewModel(null);
 }
Exemplo n.º 6
0
 public void PropertyChangedEvent_When_IsOnline_Updated()
 {
     bool result = false;
     AgentProfile agentProfile = new AgentProfile("agent");
     AgentViewModel target = new AgentViewModel(agentProfile);
     target.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler((o,e) => { if (e.PropertyName.Equals("IsOnline")) result = true; });
     target.IsOnline = true;
     Assert.IsTrue(result);
 }
Exemplo n.º 7
0
 public void IsOnline_Can_Be_Set()
 {
     AgentProfile agentProfile = new AgentProfile("agent");
     AgentViewModel target = new AgentViewModel(agentProfile);
     target.IsOnline = true;
     Assert.IsTrue(target.IsOnline);
 }