Exemplo n.º 1
0
        public void Start(string taskName)
        {
            // lets do the waiting threads their work
            Thread.Sleep(0);

            var taskInfo = new TaskInfo(taskName);
            TimeDetails.Add(taskInfo);
            taskInfo.Start();
        }
Exemplo n.º 2
0
        public void default_ctor_success()
        {
            // Arrange

            // Act
            var taskInfo = new TaskInfo();

            // Assert
            Assert.IsNull(taskInfo.Name);
            Assert.AreEqual(0.0d, taskInfo.Duration);
        }
Exemplo n.º 3
0
        public void double_start_no_exception()
        {
            // Arrange

            // Act
            var taskInfo = new TaskInfo();
            taskInfo.Start();
            taskInfo.Start();

            // Assert
            // If we get here w/o an exception, we passed
        }
Exemplo n.º 4
0
        public void SummaryMessage_assembled()
        {
            // Arrange
            var task1 = new TaskInfo("task1") { Duration = 13 };
            var task2 = new TaskInfo("task2") { Duration = 27 };

            // Act
            var metricInfo = new MetricInfo("TestMetric");
            metricInfo.TimeDetails.AddRange(new[] { task1, task2 });

            // Assert
            Assert.AreEqual("'TestMetric': Time = 40.0000 seconds", metricInfo.SummaryMessage);
        }
Exemplo n.º 5
0
        public void double_stop_extends_duration()
        {
            // Arrange

            // Act
            var taskInfo = new TaskInfo();
            taskInfo.Start();
            Thread.Sleep(31);
            taskInfo.Stop();
            Thread.Sleep(31);
            taskInfo.Stop();

            // Assert
            Assert.LessOrEqual(.060, taskInfo.Duration);
        }
Exemplo n.º 6
0
        public void TotalTimeInSeconds_adds_up()
        {
            // Arrange
            var task1 = new TaskInfo("task1") {Duration = 13};
            var task2 = new TaskInfo("task2") {Duration = 27};

            // Act
            var metricInfo = new MetricInfo();
            metricInfo.TimeDetails.AddRange(new[] {task1, task2});

            // Assert
            Assert.AreEqual(40.0d, metricInfo.TotalTimeInSeconds);
            Assert.AreEqual(40.0d, metricInfo.Duration);
        }
Exemplo n.º 7
0
        public void name_ctor_success()
        {
            // Arrange
            const string TEST_NAME = "Test Name";

            // Act
            var taskInfo = new TaskInfo(TEST_NAME);

            // Assert
            Assert.AreEqual(TEST_NAME, taskInfo.Name);
            Assert.AreEqual(0.0d, taskInfo.Duration);
        }
Exemplo n.º 8
0
        public void start_stop_check_time_success()
        {
            // Arrange

            // Act
            var taskInfo = new TaskInfo();
            taskInfo.Start();
            Thread.Sleep(31);
            taskInfo.Stop();

            // Assert
            Assert.LessOrEqual(.030, taskInfo.Duration);
        }