Example #1
0
 public void WrongPathThrowsException()
 {
     Should.Throw <DirectoryNotFoundException>(
         () => TestSystem.RunTests("no_existed_folder"));
     Should.Throw <IOException>(
         () => TestSystem.RunTests("../../../MyNUnit.csproj"));
 }
Example #2
0
        public void TestClassWithoutParameterlessConstructorThrowsException()
        {
            var exception = Should.Throw <AggregateException>(
                () => TestSystem.RunTests("../../../../TestProjects/TestProject8/bin"));

            exception.InnerException.InnerException.ShouldBeOfType <InvalidConstructorException>();
        }
Example #3
0
        public void TestWithParametersThrowsException()
        {
            var exception = Should.Throw <AggregateException>(
                () => TestSystem.RunTests("../../../../TestProjects/TestProject9/bin"));

            exception.InnerException.InnerException.ShouldBeOfType <InvalidTestMethodException>();
        }
Example #4
0
        public void ExcpectedWorksRight()
        {
            TestSystem.RunTests("../../../../TestProjects/TestProject7/bin");

            TestSystem.Succeeded.ShouldContain("TestProject7.TestClass7.ExceptionTest");
            TestSystem.Failed.ShouldContain("TestProject7.TestClass7.FailedExceptionTest");
        }
Example #5
0
        public void IgnoreWorksRight()
        {
            TestSystem.RunTests("../../../../TestProjects/TestProject7/bin");

            TestClass7.Ignored = true;
            TestSystem.Ignored.Count.ShouldBe(1);
            TestSystem.Ignored.ShouldContain("TestProject7.TestClass7.IgnoredTest");
        }
        public void BeforeClassAndAfterClassMethodsRunProperly()
        {
            TestClass5.BeforeClassExecuted = new[] { 0, 0 };
            TestClass5.AfterClassExectured = new[] { 0 };

            TestSystem.RunTests("../../../../TestProjects/TestProject5/bin");

            TestClass5.BeforeClassExecuted.ShouldBe(new[] { 1, 1 });
            TestClass5.AfterClassExectured.ShouldBe(new[] { 1 });
        }
        public void AfterAndTestMethodsRunOnTheSameInstance()
        {
            var instance1 = new TestClass10();
            var instance2 = new TestClass10();

            instance1.GetHashCode().ShouldNotBe(instance2.GetHashCode());

            TestSystem.RunTests("../../../../TestProjects/TestProject10/bin");
            TestClass10.AfterHash.ShouldBe(TestClass10.TestHash);
        }
        public void BeforeAndAfterMethodsRunProperly()
        {
            TestClass4.BeforeExecuted = new[] { 0, 0 };
            TestClass4.AfterExectured = new[] { 0 };

            TestSystem.RunTests("../../../../TestProjects/TestProject4/bin");

            TestClass4.BeforeExecuted.ShouldBe(new[] { 2, 2 });
            TestClass4.AfterExectured.ShouldBe(new[] { 2 });
        }
Example #9
0
        public void SimpleTestResultsAreRight()
        {
            TestSystem.RunTests("../../../../TestProjects/TestProject6/bin");

            TestSystem.Succeeded.Count.ShouldBe(2);
            TestSystem.Failed.Count.ShouldBe(2);

            TestSystem.Succeeded.ShouldContain("TestProject6.TestClass6.PassedTest1");
            TestSystem.Succeeded.ShouldContain("TestProject6.TestClass6.PassedTest2");

            TestSystem.Failed.ShouldContain("TestProject6.TestClass6.FailedTest1");
            TestSystem.Failed.ShouldContain("TestProject6.TestClass6.FailedTest2");
        }
 public void TestMethodsRunInParallel()
 {
     TestSystem.RunTests("../../../../TestProjects/TestProject3/bin");
     TestClass3.Threads.ShouldBeUnique();
 }
 public void TestMethodsRunOnce()
 {
     TestClass2.Executed = new[] { 0, 0, 0 };
     TestSystem.RunTests("../../../../TestProjects/TestProject2/bin");
     TestClass2.Executed.ShouldAllBe(count => count == 1);
 }
 public void TestMethodsRun()
 {
     TestClass1.Executed = new[] { false, false, false };
     TestSystem.RunTests("../../../../TestProjects/TestProject1/bin");
     TestClass1.Executed.ShouldAllBe(flag => flag);
 }