예제 #1
0
        public void ShouldUnpackResultValuesFromStronglyTypedTaskObjectsForAsyncCases()
        {
            using (var console = new RedirectedConsole())
            {
                var discovery = new SelfTestDiscovery();
                var execution = new TreatBoolReturnValuesAsAssertions();

                Run <SampleAsyncTestClass>(discovery, execution)
                .ShouldBe(
                    For <SampleAsyncTestClass>(
                        ".BoolFalse failed: Boolean test case returned false!",
                        ".BoolThrow failed: 'BoolThrow' failed!",
                        ".BoolTrue passed",
                        ".Pass passed",
                        ".String passed",
                        ".StringNull passed",
                        ".Throw failed: 'Throw' failed!"));

                console.Lines().ShouldBe(
                    "BoolFalse False",
                    "BoolThrow null",
                    "BoolTrue True",
                    "Pass null",
                    "String ABC",
                    "StringNull null",
                    "Throw null");
            }
        }
예제 #2
0
        public void ShouldProvideCaseReturnValuesToCustomBehaviors()
        {
            using (var console = new RedirectedConsole())
            {
                var discovery = new SelfTestDiscovery();
                var execution = new TreatBoolReturnValuesAsAssertions();

                Run <SampleTestClass>(discovery, execution)
                .ShouldBe(
                    For <SampleTestClass>(
                        ".BoolFalse failed: Boolean test case returned false!",
                        ".BoolThrow failed: 'BoolThrow' failed!",
                        ".BoolTrue passed",
                        ".Pass passed",
                        ".String passed",
                        ".StringNull passed",
                        ".Throw failed: 'Throw' failed!"));

                console.Lines().ShouldBe(
                    "BoolFalse False",
                    "BoolThrow null",
                    "BoolTrue True",
                    "Pass null",
                    "String ABC",
                    "StringNull null",
                    "Throw null");
            }
        }