Exemple #1
0
        public void MismatchedTypeAddTestBlockParamsAndExecuteArgsFails()
        {
            TestBuilder builder = new TestBuilder();

            builder.AddTestBlock <ExampleTestBlockWithExecuteArg>(1234);

            Assert.Throws <TestCaseException>(() => builder.ExecuteTestCase());
        }
Exemple #2
0
        public void PassExecuteArgumentsViaAddTestBlockParams()
        {
            TestBuilder builder = new TestBuilder();

            builder
            .AddTestBlock <ExampleTestBlockWithExecuteArg>("Testing")
            .ExecuteTestCase();
        }
Exemple #3
0
        public void AddFinallyBlockDoesNotThrowIfExceptionOccursInFinally()
        {
            TestBuilder builder = new TestBuilder();

            builder
            .AddTestBlock <ExampleTestBlockWithReturn>(true)
            .AddFinallyBlock <ExampleFinallyBlock>()
            .ExecuteTestCase();
        }
Exemple #4
0
        public void AddFinallyBlockThrowsExpectedException()
        {
            TestBuilder builder = new TestBuilder();

            builder
            .AddTestBlock <ExampleTestBlockWithReturn>(false)
            .AddFinallyBlock <ExampleFinallyBlock>()
            .ExecuteTestCase();
        }
Exemple #5
0
        public void PropertyWithNoMatchingTypeInDiThrowsInvalidOperation()
        {
            TestBuilder builder = new TestBuilder();

            builder.AddTestBlock <ExampleTestBlockWithProperty>();

            Exception ex = Assert.Throws <TestCaseException>(() => builder.ExecuteTestCase());

            Assert.Equal(typeof(InvalidOperationException), ex.InnerException.GetType());
        }
Exemple #6
0
        public void TestBlockThatFailsThrowsCorrectException()
        {
            TestBuilder builder = new TestBuilder();

            builder
            .AddTestBlock <ExampleTestBlockWithExecuteArg>("Bad Value");

            try
            {
                builder.ExecuteTestCase();
            }
            catch (TestCaseException ex)
            {
                Assert.Equal(typeof(EqualException), ex.InnerException.GetType());
            }
        }