Пример #1
0
        public void Herd_AvailableMemoryNormalization()
        {
            HerdAgentInfo herdAgent = new HerdAgentInfo();

            herdAgent.AddProperty(PropNames.TotalMemory, "1024Mb");
            Assert.AreEqual("1Gb", herdAgent.Memory);

            herdAgent.AddProperty(PropNames.TotalMemory, "1024Kb");
            Assert.AreEqual("0Gb", herdAgent.Memory);

            herdAgent.AddProperty(PropNames.TotalMemory, "1024Gb");
            Assert.AreEqual("1024Gb", herdAgent.Memory);

            herdAgent.AddProperty(PropNames.TotalMemory, "1046Mb");
            Assert.AreEqual("1Gb", herdAgent.Memory);

            herdAgent.AddProperty(PropNames.TotalMemory, "512Mb");
            Assert.AreEqual("0.5Gb", herdAgent.Memory);

            herdAgent.AddProperty(PropNames.TotalMemory, Convert.ToString(1024 * 1024 * 1024));
            Assert.AreEqual("1Gb", herdAgent.Memory);

            herdAgent.AddProperty(PropNames.TotalMemory, Convert.ToString(1024 * 1024));
            Assert.AreEqual("0Gb", herdAgent.Memory);
        }
Пример #2
0
        public HerdAgentViewModel(HerdAgentInfo info)
        {
            Info      = info;
            IpAddress = Info.ipAddress;

            //deselect local agent by default
            m_bLocalAgent = IsLocalIpAddress(IpAddressString);
            IsSelected    = !m_bLocalAgent;
        }
Пример #3
0
        public void Herd_ProcessorLoadNormalization()
        {
            HerdAgentInfo herdAgent = new HerdAgentInfo();

            herdAgent.AddProperty(PropNames.ProcessorLoad, "12,344332");
            Assert.AreEqual("12.34%", herdAgent.ProcessorLoad);

            herdAgent.AddProperty(PropNames.ProcessorLoad, "12.3");
            Assert.AreEqual("12.3%", herdAgent.ProcessorLoad);

            herdAgent.AddProperty(PropNames.ProcessorLoad, "12.344332");
            Assert.AreEqual("12.34%", herdAgent.ProcessorLoad);

            herdAgent.AddProperty(PropNames.ProcessorLoad, "12");
            Assert.AreEqual("12%", herdAgent.ProcessorLoad);
        }
Пример #4
0
        private void OnHerdAgetDiscovery(HerdAgentInfo newHerdAgent)
        {
            int i = 0;

            while (i < HerdAgentList.Count - 1 && HerdAgentList[i].NumProcessors >= newHerdAgent.NumProcessors)
            {
                i++;
            }

            if (i <= HerdAgentList.Count - 1)
            {
                HerdAgentList.Insert(i, new HerdAgentViewModel(newHerdAgent));
            }
            else
            {
                HerdAgentList.Add(new HerdAgentViewModel(newHerdAgent));
            }

            NotifyOfPropertyChange(() => HerdAgentList);
        }
Пример #5
0
 public HerdAgentViewModel(HerdAgentInfo info)
 {
     m_herdAgentInfo = info;
 }