예제 #1
0
        public async Task TestMethodCall_ShouldReturnRightResult(string workerName, int a)
        {
            var jsExecutor = BuilderCallTests.BuildAndGetExecutor(workerName);

            var expectedRes = await new BuilderCallTests.SomeService().SomeTask(a);
            var res         = jsExecutor.CallWorkerMethod <int>(workerName, BuilderCallTests.MultiplyByTwoMethodName, a);

            Assert.AreEqual(expectedRes, res);
        }
예제 #2
0
        public void TestMethodCall_WithMissingParameters_ShouldThrow(string workerName)
        {
            var jsExecutor = BuilderCallTests.BuildAndGetExecutor(workerName);

            var ex = Assert.Throws <InvalidOperationException>(() => jsExecutor.CallWorkerMethod <int>(workerName,
                                                                                                       BuilderCallTests.MultiplyByTwoMethodName));

            var mes = string.Format(ExceptionTexts.MethodWasCalledWithLessParamsFormat,
                                    BuilderCallTests.MultiplyByTwoMethodName, workerName, 1, 0);

            Assert.AreEqual(mes, ex.Message);
        }