Exemplo n.º 1
0
        public void BadnessOrder()
        {
            ReportStatus success = new ReportStatus.Success();
            ReportStatus failed = new ReportStatus.Failed();
            ReportStatus error = new ReportStatus.Error();
            ReportStatus notRunned = new ReportStatus.NotRunned();

            //Tests for Not Runned
            AssertEx.That(notRunned.IsWorseThan(notRunned), Is.False());
            AssertEx.That(notRunned.IsWorseThan(success), Is.False());
            AssertEx.That(notRunned.IsWorseThan(failed), Is.False());
            AssertEx.That(notRunned.IsWorseThan(error), Is.False());

            //Tests for Success
            AssertEx.That(success.IsWorseThan(notRunned), Is.True());
            AssertEx.That(success.IsWorseThan(success), Is.False());
            AssertEx.That(success.IsWorseThan(failed), Is.False());
            AssertEx.That(success.IsWorseThan(error), Is.False());

            //Tests for Failed
            AssertEx.That(failed.IsWorseThan(notRunned), Is.True());
            AssertEx.That(failed.IsWorseThan(success), Is.True());
            AssertEx.That(failed.IsWorseThan(failed), Is.False());
            AssertEx.That(failed.IsWorseThan(error), Is.False());

            //Tests for Error
            AssertEx.That(error.IsWorseThan(notRunned), Is.True());
            AssertEx.That(error.IsWorseThan(success), Is.True());
            AssertEx.That(error.IsWorseThan(failed), Is.True());
            AssertEx.That(error.IsWorseThan(error), Is.False());
        }
Exemplo n.º 2
0
        public SimpleClassReport(Type testClass)
        {
            if (testClass == null) {
                throw new ArgumentException("The test class of a SimpleClassReport mustn't be null.");
            }
            if (testClass.GetCustomAttribute<JUUTTestClassAttribute>() == null) {
                throw new ArgumentException("The test class of a SimpleClassReport needs the JUUTTestClass-Attribute.");
            }

            Reports = new Dictionary<MethodInfo, MethodReport>();
            TestClass = testClass;
            Status = new ReportStatus.NotRunned();
        }
Exemplo n.º 3
0
        public void DescribingText()
        {
            ReportStatus status = new ReportStatus.NotRunned();
            AssertEx.That(status.DescribingText, Is.EqualTo("wasn't run"));

            status = new ReportStatus.Success();
            AssertEx.That(status.DescribingText, Is.EqualTo("passed successfully"));

            status = new ReportStatus.Failed();
            AssertEx.That(status.DescribingText, Is.EqualTo("failed"));

            status = new ReportStatus.Error();
            AssertEx.That(status.DescribingText, Is.EqualTo("threw an unexpected exception"));
        }
Exemplo n.º 4
0
        public void Name()
        {
            Exception raisedException = null;
            ReportStatus status = ReportStatus.Create(raisedException);
            AssertEx.That(status.Name, Is.EqualTo("Success"));

            raisedException = new AssertException("Assert Exception");
            status = ReportStatus.Create(raisedException);
            AssertEx.That(status.Name, Is.EqualTo("Failed"));

            raisedException = new NullReferenceException("Other Exception");
            status = ReportStatus.Create(raisedException);
            AssertEx.That(status.Name, Is.EqualTo("Error"));

            status = new ReportStatus.NotRunned();
            AssertEx.That(status.Name, Is.EqualTo("Not Runned"));
        }