Exemplo n.º 1
0
        public void ProcessModel_GetProcessModel_ShouldReturnCorrectValues()
        {
            _processAdapter.Setup(p => p.TotalProcessorTime).Returns(TimeSpan.FromHours(1));
            _processAdapter.Setup(p => p.StartTime).Returns(_testDateTime.AddHours(-1));

            var processModel = new ProcessModel(_clock.Object);

            processModel.GetProcessModel(_processAdapter.Object);

            Assert.That(processModel.Id, Is.EqualTo(_processAdapter.Object.Id));
            Assert.That(processModel.Name, Is.EqualTo(_processAdapter.Object.ProcessName));
            Assert.That(processModel.RunningTime, Is.GreaterThanOrEqualTo(TimeSpan.Zero));
            Assert.That(processModel.CpuUsageTime, Is.GreaterThanOrEqualTo(TimeSpan.Zero));
            Assert.That(processModel.CpuUsagePercent, Is.GreaterThanOrEqualTo(0));
        }