示例#1
0
 private static void ConfigureTestProject(ITestCaseExecuter testCaseExecuter)
 {
     TestCase testCase = new TestCase
     {
         ClassName = "Moya.Dummy.Test.Project.Configuration",
         MethodName = "Configure",
         FilePath = GetMoyaDummyTestProjectDllPath()
     };
     testCaseExecuter.RunTest(testCase);
 }
示例#2
0
            public void RunTestWithCustomPostTestRunnerShouldRunTestRunner()
            {
                ConfigureTestProject(testCaseExecuter);
                TestCase testCase = new TestCase
                {
                    ClassName = "Moya.Dummy.Test.Project.CustomPostTestExample",
                    MethodName = "MyTestMethod",
                    FilePath = GetMoyaDummyTestProjectDllPath()
                };

                var result = testCaseExecuter.RunTest(testCase);

                result.First().Outcome.ShouldBe(TestOutcome.Success);
                result.First().TestType.ShouldBe(TestType.PostTest);
                result.Count.ShouldBe(1);
            }
示例#3
0
            public void RunTestWithInvalidClassShouldThrowMoyaException()
            {
                TestCase testCase = new TestCase
                {
                    ClassName = "Moya.Dummy.Test.Project.NotATestClass",
                    MethodName = "AMethod",
                    FilePath = GetMoyaDummyTestProjectDllPath()
                };
                const string ExpectedExceptionMessageStart = "Unable to find method from assembly.Assembly file path: ";
                const string ExpectedExceptionMessageEnd = "\nClass name: Moya.Dummy.Test.Project.NotATestClass\nMethod name: AMethod";

                var exception = Record.Exception(() => testCaseExecuter.RunTest(testCase));

                Assert.Equal(typeof(MoyaException), exception.GetType());
                exception.Message.ShouldStartWith(ExpectedExceptionMessageStart);
                exception.Message.ShouldEndWith(ExpectedExceptionMessageEnd);
            }
示例#4
0
            public void RunTestWithDummyClassShouldReturnCollectionWithOneSuccessfullResult()
            {
                TestCase testCase = new TestCase
                {
                    ClassName = "Moya.Dummy.Test.Project.TestClass",
                    MethodName = "OnlyWarmupMethod",
                    FilePath = GetMoyaDummyTestProjectDllPath()
                };

                var testResult = testCaseExecuter.RunTest(testCase);

                Assert.Equal(1, testResult.Count(x => x.Outcome == TestOutcome.Success));
                Assert.Equal(TestOutcome.Success, testResult.First().Outcome);
            }