EmptyConstraint tests a whether a string or collection is empty, postponing the decision about which test is applied until the type of the actual argument is known.
Наследование: NUnit.Framework.Constraints.Constraint
Пример #1
0
 protected override void SetUp()
 {
     Matcher = new EmptyConstraint();
     GoodValues = new object[] { string.Empty, new object[0], new System.Collections.ArrayList() };
     BadValues = new object[] { "Hello", new object[] { 1, 2, 3 } };
     Description = "<empty>";
 }
Пример #2
0
        public void AssertTestCase_TestCaseFailing_MessageIsAvailable()
        {
            var sut = "not empty string";
            var ctr = new EmptyConstraint();
            var xmlContent = "<test><system></system><assert></assert></test>";

            var testSuite = new TestSuite();

            try
            {
                testSuite.AssertTestCase(sut, ctr, xmlContent);
            }
            catch (AssertionException ex)
            {
                Console.WriteLine(ex.Message);
                Assert.That(ex.Message, Is.StringContaining("empty"));
            }
            catch (Exception ex)
            {
                Assert.Fail("The exception should have been an AssertionException but was {0}.", new object[] { ex.GetType().FullName });
            }
        }
Пример #3
0
 public void SetUp()
 {
     TheConstraint        = new EmptyConstraint();
     ExpectedDescription  = "<empty>";
     StringRepresentation = "<empty>";
 }
Пример #4
0
 public void SetUp()
 {
     theConstraint = new EmptyConstraint();
     expectedDescription = "<empty>";
     stringRepresentation = "<empty>";
 }
Пример #5
0
        public void AssertTestCase_TestCaseFailing_StackTraceIsFilledWithXml()
        {
            var sut = "not empty";
            var ctr = new EmptyConstraint();
            var xmlContent = "<test><system></system><assert></assert></test>";

            var testSuite = new TestSuite();

            try
            {
                testSuite.AssertTestCase(sut, ctr, xmlContent);
            }
            catch (AssertionException ex)
            {
                Assert.That(ex.StackTrace, Is.EqualTo(xmlContent));
            }
            catch (Exception ex)
            {
                Assert.Fail("The exception should have been an AssertionException but was {0}.", new object[] { ex.GetType().FullName });
            }
        }