I am trying to test a method which takes two string passed by
reference.
My test passed when I was expecting it to fail, because I reversed the
two parameters.
Could you point me in the right direction on how to verify the order
of parameters.
Thanks
Newton.
<code>
using Rhino.Mocks; // Version 3.5.0.2
using NUnit.Framework; // Version 2.5.0.8258
[TestFixture]
public class ClientAccessTest
{
[Test]
public void SecurityLogTest()
{
MockRepository mocks = new MockRepository();
SecurityLog log = mocks.StrictMock<SecurityLog>();
string userName = "ClientName";
string userIp = "127.0.0.1";
using (mocks.Record())
{
log.LogEntry(ref userName, ref userIp);
}
using(mocks.Playback())
{
// This test should fail, User name and ip are
reversed.
ClientAccess access = new ClientAccess(log);
access.ClientEntry(ref userName, ref userIp);
}
}
}
public class ClientAccess
{
private SecurityLog securityLog;
public ClientAccess(SecurityLog log)
{
securityLog = log;
}
public bool ClientEntry(ref string userName, ref string
userIp)
{
// Reverse the parameters around...This should cause a
failure.
return securityLog.LogEntry(ref userIp, ref userName);
}
}
public class SecurityLog
{
public bool LogEntry(ref string userName, ref string userIp)
{
return true;
}
}
</code>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---