From 9d0015c85facf0381341b0c75329bc9ac519b92a Mon Sep 17 00:00:00 2001 From: George Cook Date: Thu, 21 Mar 2019 17:17:10 -0500 Subject: [PATCH] adds additinoaly testing to ensure that there were no regressions on non-overloaded expects mixed with overloaded ones --- .../source/tests/AssertionTests.brs | 80 ++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/frameworkTests/source/tests/AssertionTests.brs b/frameworkTests/source/tests/AssertionTests.brs index fc54ddb9..e4716322 100644 --- a/frameworkTests/source/tests/AssertionTests.brs +++ b/frameworkTests/source/tests/AssertionTests.brs @@ -389,7 +389,7 @@ function Simp_expect_multiExpect_success_oneCallsArgsNotTracked() result = obj.mockMethod(arg1) m.AssertEqual(result, result1) - + result = obj.mockMethod("do not care about args", "used in invocation", 2) m.AssertEqual(result, result2) @@ -435,6 +435,84 @@ function Simp_expect_multiExpect_multi_args_success() end function +'@Test multi test, multi params with other expects +function Simp_expect_multiExpect_multi_args_others_success() + obj = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 + + m.expectOnce(obj, "anotherMockMethod", invalid, "another", true) + m.expectOnce(obj, "anotherMockMethod2", [1,2,3], "another2", true) + m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true) + m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true) + m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true) + + result = obj.anotherMockMethod() + m.AssertEqual(result, "another") + + result = obj.anotherMockMethod2(1, 2, 3) + m.AssertEqual(result, "another2") + + result = obj.mockMethod(arg1, arg2, arg3) + m.AssertEqual(result, result) + + result = obj.mockMethod(arg2, arg3, arg1) + m.AssertEqual(result, result2) + + result = obj.mockMethod(arg3, arg2, arg1) + m.AssertEqual(result, result3) + + m.assertMocks() + isFail = m.currentResult.isFail + + m.currentResult.Reset() + m.AssertFalse(isFail) + +end function + +'@Test multi test, multi params with other expects - fail others +function Simp_expect_multiExpect_multi_args_others_fail() + obj = {} + arg1 = "arg1" + arg2 = "arg2" + arg3 = "arg3" + result1 = 1 + result2 = 2 + result3 = 3 + + m.expectOnce(obj, "anotherMockMethod", ["not passed"], "another", true) + m.expectOnce(obj, "anotherMockMethod2", [1,2,3], "another2", true) + m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true) + m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true) + m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true) + + result = obj.anotherMockMethod() + m.AssertEqual(result, "another") + + result = obj.anotherMockMethod2(1, 2, 3) + m.AssertEqual(result, "another2") + + result = obj.mockMethod(arg1, arg2, arg3) + m.AssertEqual(result, result) + + result = obj.mockMethod(arg2, arg3, arg1) + m.AssertEqual(result, result2) + + result = obj.mockMethod(arg3, arg2, arg1) + m.AssertEqual(result, result3) + + m.assertMocks() + isFail = m.currentResult.isFail + + m.currentResult.Reset() + m.AssertTrue(isFail) + +end function + '@Test can set up multi expects on same method '@Params["arg1_", "arg2", "arg3"] '@Params["arg1", "arg2", "arg3_"]