Unable to mock the ref and out parameter of the function, test case fails occasionally.
public void test1()
string expected = null;
string s1 ="hi";
string xpected = "pound";
string key = "Test";
langType ret_lang = langType.English;
using (RecordExpectations recorder = RecorderManager.StartRecording())
string Lang = privateTarget.CLanguage(ref key, ref ret_lang);
privateTarget.CLa(key, ref s1, ref s2);
Assert.AreEqual(expected, s1, "s1_CLa_expected was not set correctly.");
Assert.AreEqual(xpected, s2, "s2_CLa_expected was not set correctly.");
Public void CLa(key, ref s1, ref s2)
s1 = null
string key = "Mother Tongue"
langType ret_lang = langType.French;
string st = CLanguage(key, ref ret_lang);
If ret_lang = French Then
s1 = st
s2 = st
When the test case fails the ret_Lang = French. Thus mocking the ref and out parameter fails occassionally.
I have tried the dynamic mocking but still the test case fails ocassionally.
I am not able to make the test case pass consistently.
Typemock.NET version 126.96.36.199
The Testcase is in C#.Net and the
Function is in VB.Net
Please help me out to resolve this issue.
Thanks in advance.