The ResultState class represents the outcome of running a test. It contains two pieces of information. The Status of the test is an enum indicating whether the test passed, failed, was skipped or was inconclusive. The Label provides a more detailed breakdown for use by client runners.
Esempio n. 1
0
 private void InitializeResultProperties()
 {
     Status = GetStatus();
     Label = GetAttribute("label");
     Outcome = new ResultState(Status, Label);
     AssertCount = GetAttribute("asserts", 0);
     Duration = double.Parse(GetAttribute("duration"));
 }
Esempio n. 2
0
        public void Status_ConstructorWithTwoArguments_ReturnsConstructorArgumentStatus(TestStatus status)
        {
            ResultState resultState = new ResultState(status, string.Empty);

            Assert.AreEqual(status, resultState.Status);
        }
Esempio n. 3
0
        public void Label_ConstructorWithOneArguments_ReturnsStringEmpty()
        {
            ResultState resultState = new ResultState(TestStatus.Failed);

            Assert.AreEqual(string.Empty, resultState.Label);
        }
Esempio n. 4
0
        public void ToString_Constructor_ReturnsExpectedString(TestStatus status, string label, string expected)
        {
            ResultState resultState = new ResultState(status, label);

            Assert.AreEqual(expected, resultState.ToString());
        }
Esempio n. 5
0
        public void Site_ConstructorWithThreeArguments_ReturnsSite(string label, FailureSite site)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label, site);

            Assert.AreEqual(site, resultState.Site);
        }
Esempio n. 6
0
        public void ToString_Constructor_ReturnsExpectedString(TestStatus status, string label, string expected)
        {
            ResultState resultState = new ResultState(status, label);

            Assert.AreEqual(expected, resultState.ToString());
        }
Esempio n. 7
0
        public void Site_ConstructorWithThreeArguments_ReturnsSite(string label, FailureSite site)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label, site);

            Assert.AreEqual(site, resultState.Site);
        }
Esempio n. 8
0
        public void Site_ConstructorWithOneArguments_ReturnsTest()
        {
            ResultState resultState = new ResultState(TestStatus.Failed);

            Assert.AreEqual(FailureSite.Test, resultState.Site);
        }
Esempio n. 9
0
        public void Label_ConstructorWithTwoArguments_ReturnsConstructorArgumentLabel(string label)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label);

            Assert.AreEqual(label, resultState.Label);
        }
Esempio n. 10
0
        public void Status_ConstructorWithTwoArguments_ReturnsConstructorArgumentStatus(TestStatus status)
        {
            ResultState resultState = new ResultState(status, string.Empty);

            Assert.AreEqual(status, resultState.Status);
        }
Esempio n. 11
0
        public void Label_ConstructorWithOneArguments_ReturnsStringEmpty()
        {
            ResultState resultState = new ResultState(TestStatus.Failed);

            Assert.AreEqual(string.Empty, resultState.Label);
        }
Esempio n. 12
0
        public void AddSiteToResult(TestStatus status, string label, FailureSite site)
        {
            var result = new ResultState(status, label).WithSite(site);

            Assert.That(result.Status, Is.EqualTo(status));
            Assert.That(result.Label, Is.EqualTo(label));
            Assert.That(result.Site, Is.EqualTo(site));
        }
Esempio n. 13
0
 public void TestEquality_Null()
 {
     var rs = new ResultState(TestStatus.Passed);
     Assert.AreNotEqual(null, rs);
     Assert.AreNotEqual(rs, null);
     Assert.False(rs.Equals(null));
 }
Esempio n. 14
0
        public void TestEquality_WrongType()
        {
            var rs = new ResultState(TestStatus.Passed);
            var s = "123";

            Assert.AreNotEqual(rs, s);
            Assert.AreNotEqual(s, rs);
            Assert.False(rs.Equals(s));
        }
Esempio n. 15
0
        public void Label_ConstructorWithTwoArguments_ReturnsConstructorArgumentLabel(string label)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label);

            Assert.AreEqual(label, resultState.Label);
        }
Esempio n. 16
0
        public void Label_ConstructorWithTwoArgumentsLabelArgumentIsNull_ReturnsEmptyString()
        {
            ResultState resultState = new ResultState(TestStatus.Failed, null);

            Assert.AreEqual(string.Empty, resultState.Label);
        }
Esempio n. 17
0
        public void Label_ConstructorWithTwoArgumentsLabelArgumentIsNull_ReturnsEmptyString()
        {
            ResultState resultState = new ResultState(TestStatus.Failed, null);

            Assert.AreEqual(string.Empty, resultState.Label);
        }
Esempio n. 18
0
        public void Site_ConstructorWithTwoArguments_ReturnsTest(string label)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label);

            Assert.AreEqual(FailureSite.Test, resultState.Site);
        }
Esempio n. 19
0
        public void Site_ConstructorWithOneArguments_ReturnsTest()
        {
            ResultState resultState = new ResultState(TestStatus.Failed);

            Assert.AreEqual(FailureSite.Test, resultState.Site);
        }
Esempio n. 20
0
        public void Site_ConstructorWithTwoArguments_ReturnsTest(string label)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label);

            Assert.AreEqual(FailureSite.Test, resultState.Site);
        }
Esempio n. 21
0
 private void InitializeResultProperties()
 {
     Status = GetStatus();
     Label = GetAttribute("label");
     Outcome = new ResultState(Status, Label);
     AssertCount = GetAttribute("asserts", 0);
     var duration = GetAttribute("duration");
     Duration = duration != null
         ? double.Parse(duration, CultureInfo.InvariantCulture)
         : 0.0;
 }