void should_also_fail_this_example()
 {
     it["should also fail"] = () =>
     {
         ExamplesRun.Add("should also fail");
         Assert.That(true, Is.True);
     };
 }
コード例 #2
0
            void method_level_context()
            {
                beforeAll = () => { throw new BeforeAllException(); };

                // just by its presence, this will enforce tests as it should never be reported
                afterAll = () => { throw new AfterAllException(); };

                it["should fail this example because of beforeAll"] = () =>
                {
                    ExamplesRun.Add("should fail this example because of beforeAll");
                    Assert.That(true, Is.True);
                };

                it["should also fail this example because of beforeAll"] = () =>
                {
                    ExamplesRun.Add("should also fail this example because of beforeAll");
                    Assert.That(true, Is.True);
                };

                it["overrides exception from same level it"] = () =>
                {
                    ExamplesRun.Add("overrides exception from same level it");
                    throw new ItException();
                };

                context["exception thrown by both beforeAll and nested before"] = () =>
                {
                    before = () => { throw new BeforeException(); };

                    it["overrides exception from nested before"] = () =>
                    {
                        ExamplesRun.Add("overrides exception from nested before");
                        Assert.That(true, Is.True);
                    };
                };

                context["exception thrown by both beforeAll and nested act"] = () =>
                {
                    act = () => { throw new ActException(); };

                    it["overrides exception from nested act"] = () =>
                    {
                        ExamplesRun.Add("verrides exception from nested act");
                        Assert.That(true, Is.True);
                    };
                };

                context["exception thrown by both beforeAll and nested it"] = () =>
                {
                    it["overrides exception from nested it"] = () =>
                    {
                        ExamplesRun.Add("overrides exception from nested it");
                        throw new ItException();
                    };
                };

                context["exception thrown by both beforeAll and nested after"] = () =>
                {
                    it["overrides exception from nested after"] = () =>
                    {
                        ExamplesRun.Add("exception thrown by both beforeAll and nested after");
                        Assert.That(true, Is.True);
                    };

                    after = () => { throw new AfterException(); };
                };
            }
 void it_should_fail_because_of_parent()
 {
     ExamplesRun.Add("it_should_fail_because_of_parent");
     Assert.That(true, Is.True);
 }
コード例 #4
0
            void method_level_context()
            {
                act = () => { throw new ActException(); };

                it["should fail this example because of act"] = () =>
                {
                    ExamplesRun.Add("should fail this example because of act");
                    Assert.That(true, Is.True);
                };

                it["should also fail this example because of act"] = () =>
                {
                    ExamplesRun.Add("should also fail this example because of act");
                    Assert.That(true, Is.True);
                };

                it["overrides exception from same level it"] = () =>
                {
                    ExamplesRun.Add("overrides exception from same level it");
                    throw new ItException();
                };

                context["exception thrown by both act and nested before"] = () =>
                {
                    before = () => { throw new BeforeException(); };

                    it["preserves exception from nested before"] = () =>
                    {
                        ExamplesRun.Add("preserves exception from nested before");
                        Assert.That(true, Is.True);
                    };
                };

                context["exception thrown by both act and nested act"] = () =>
                {
                    act = () => { throw new NestedActException(); };

                    it["overrides exception from nested act"] = () =>
                    {
                        ExamplesRun.Add("overrides exception from nested act");
                        Assert.That(true, Is.True);
                    };
                };

                context["exception thrown by both act and nested it"] = () =>
                {
                    it["overrides exception from nested it"] = () =>
                    {
                        ExamplesRun.Add("overrides exception from nested it");
                        throw new ItException();
                    };
                };

                context["exception thrown by both act and nested after"] = () =>
                {
                    it["overrides exception from nested after"] = () =>
                    {
                        ExamplesRun.Add("overrides exception from nested after");
                        Assert.That(true, Is.True);
                    };

                    after = () => { throw new AfterException(); };
                };
            }