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.
Пример #1
0
 private void InitializeResultProperties()
 {
     Status = GetStatus();
     Label = GetAttribute("label");
     Outcome = new ResultState(Status, Label);
     AssertCount = GetAttribute("asserts", 0);
     Duration = double.Parse(GetAttribute("duration"));
 }
Пример #2
0
        public void Status_ConstructorWithTwoArguments_ReturnsConstructorArgumentStatus(TestStatus status)
        {
            ResultState resultState = new ResultState(status, string.Empty);

            Assert.AreEqual(status, resultState.Status);
        }
Пример #3
0
        public void Label_ConstructorWithOneArguments_ReturnsStringEmpty()
        {
            ResultState resultState = new ResultState(TestStatus.Failed);

            Assert.AreEqual(string.Empty, resultState.Label);
        }
Пример #4
0
        public void ToString_Constructor_ReturnsExpectedString(TestStatus status, string label, string expected)
        {
            ResultState resultState = new ResultState(status, label);

            Assert.AreEqual(expected, resultState.ToString());
        }
Пример #5
0
        public void Site_ConstructorWithThreeArguments_ReturnsSite(string label, FailureSite site)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label, site);

            Assert.AreEqual(site, resultState.Site);
        }
Пример #6
0
        public void ToString_Constructor_ReturnsExpectedString(TestStatus status, string label, string expected)
        {
            ResultState resultState = new ResultState(status, label);

            Assert.AreEqual(expected, resultState.ToString());
        }
Пример #7
0
        public void Site_ConstructorWithThreeArguments_ReturnsSite(string label, FailureSite site)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label, site);

            Assert.AreEqual(site, resultState.Site);
        }
Пример #8
0
        public void Site_ConstructorWithOneArguments_ReturnsTest()
        {
            ResultState resultState = new ResultState(TestStatus.Failed);

            Assert.AreEqual(FailureSite.Test, resultState.Site);
        }
Пример #9
0
        public void Label_ConstructorWithTwoArguments_ReturnsConstructorArgumentLabel(string label)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label);

            Assert.AreEqual(label, resultState.Label);
        }
Пример #10
0
        public void Status_ConstructorWithTwoArguments_ReturnsConstructorArgumentStatus(TestStatus status)
        {
            ResultState resultState = new ResultState(status, string.Empty);

            Assert.AreEqual(status, resultState.Status);
        }
Пример #11
0
        public void Label_ConstructorWithOneArguments_ReturnsStringEmpty()
        {
            ResultState resultState = new ResultState(TestStatus.Failed);

            Assert.AreEqual(string.Empty, resultState.Label);
        }
Пример #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));
        }
Пример #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));
 }
Пример #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));
        }
Пример #15
0
        public void Label_ConstructorWithTwoArguments_ReturnsConstructorArgumentLabel(string label)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label);

            Assert.AreEqual(label, resultState.Label);
        }
Пример #16
0
        public void Label_ConstructorWithTwoArgumentsLabelArgumentIsNull_ReturnsEmptyString()
        {
            ResultState resultState = new ResultState(TestStatus.Failed, null);

            Assert.AreEqual(string.Empty, resultState.Label);
        }
Пример #17
0
        public void Label_ConstructorWithTwoArgumentsLabelArgumentIsNull_ReturnsEmptyString()
        {
            ResultState resultState = new ResultState(TestStatus.Failed, null);

            Assert.AreEqual(string.Empty, resultState.Label);
        }
Пример #18
0
        public void Site_ConstructorWithTwoArguments_ReturnsTest(string label)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label);

            Assert.AreEqual(FailureSite.Test, resultState.Site);
        }
Пример #19
0
        public void Site_ConstructorWithOneArguments_ReturnsTest()
        {
            ResultState resultState = new ResultState(TestStatus.Failed);

            Assert.AreEqual(FailureSite.Test, resultState.Site);
        }
Пример #20
0
        public void Site_ConstructorWithTwoArguments_ReturnsTest(string label)
        {
            ResultState resultState = new ResultState(TestStatus.Failed, label);

            Assert.AreEqual(FailureSite.Test, resultState.Site);
        }
Пример #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;
 }