chr
2026-04-05 fe750b791d5b517cc4e9bc8e99a9a75139a0cfba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Globalization;
using NUnit.Framework;
using OpenTap.Plugins.BasicSteps;
 
namespace OpenTap.Engine.UnitTests
{
    [TestFixture]
    public class TestStepRunTests
    {
        [Test]
        public void StartTimeDefault()
        {
            Assert.AreEqual(new DateTime(), new TestStepRun(new DelayStep(), Guid.NewGuid()).StartTime);
        }
 
        [Test]
        public void StartTimeInvalidValue()
        {
            var attachedParameters = new List<ResultParameter> { new ResultParameter("", "StartTime", null) };
            var testStepRun = new TestStepRun(new DelayStep(), Guid.NewGuid(), attachedParameters);
            Assert.AreEqual(new DateTime(), testStepRun.StartTime);
        }
 
        [Test]
        public void StartTimeExactDate()
        {
            var date = DateTime.ParseExact("01.01.2000 10:00", "dd.MM.yyyy hh:mm", CultureInfo.InvariantCulture);
            var attachedParameters = new List<ResultParameter> { new ResultParameter("", "StartTime", date) };
            var testStepRun = new TestStepRun(new DelayStep(), Guid.NewGuid(), attachedParameters);
            Assert.AreEqual(date, testStepRun.StartTime);
        }
        
        
        class MockPlanRun : TestPlanRun
        {
            public MockPlanRun(ResultParameters baseRun) 
                : base(new TestPlan(), Array.Empty<IResultListener>(), DateTime.Now, 0, "")
            {
                   Parameters = baseRun; // this used to cause trouble.
                Id = Guid.NewGuid();
            }
        }
 
        [Test]
        public void SetMockPlanVerdict()
        {
            var pr = new MockPlanRun(new ResultParameters(){new ResultParameter("A", 5),new ResultParameter("B", 5)});
            Assert.AreEqual(Verdict.NotSet, pr.Verdict);
            Assert.AreEqual(5, pr.Parameters["A"]);
            pr.Verdict = Verdict.Fail;
            Assert.AreEqual(Verdict.Fail, pr.Verdict);
        }
    }
}