예제 #1
0
        public void UpdateShouldUpdateMinutes()
        {
            var data = new IncomingRecordData()
            {
                CpuLoad = 100
            };
            var testDate = data.LoadedDateTime;

            var hourRecord = new HourRecord(testDate.Hour);

            hourRecord.Update(data);
            Assert.That(hourRecord.GetMinuteList().Item1, Is.EqualTo(100));

            data.CpuLoad = 300;
            hourRecord.Update(data);
            Assert.That(hourRecord.GetMinuteList().Item1, Is.EqualTo(200));
        }
예제 #2
0
        public void UpdateShouldUpdateMissingMinutes()
        {
            var data = new TestIncomingRecordData()
            {
                CpuLoad = 100, LoadedDateTime = DateTime.Now
            };
            var testDate = data.LoadedDateTime;

            var hourRecord = new HourRecord(testDate.Hour);

            hourRecord.Update(data);
            Assert.That(hourRecord.GetMinuteList().Item1[0], Is.EqualTo(100.0d));

            data.CpuLoad        = 300;
            data.LoadedDateTime = data.LoadedDateTime.Subtract(new TimeSpan(0, 0, 4, 0));
            hourRecord.Update(data);
            Assert.That(hourRecord.GetMinuteList().Item1.Count, Is.EqualTo(6));
        }
예제 #3
0
 public void GetMinuteListShouldThrowNotSupportedExceptionGivenCompleteAdding()
 {
     try
     {
         var hourRecord = new HourRecord(1);
         hourRecord.CompleteAdding();
         hourRecord.GetMinuteList();
         Assert.Fail("Expected Exception");
     }
     catch (NotSupportedException)
     {
     }
     Assert.Pass();
 }