I have a method that sets a property
public void SetNetworkCredential(string userName, string password, string domain) { _reportExecutionService.Credentials = new NetworkCredential(userName, password, domain); }
How to verify that credentials were called using a valid NetworkCredential?
I tried this TestMethod but it fails because NetworkCredential objects are different references
[TestMethod] public void TestTest() { const string userName = "userName"; const string password = "password"; const string domain = "domain"; var mock = MockRepository.GenerateMock<IReportExecutionService>(); var rptService= new ReportService(mock); rptService.SetNetworkCredential(userName, password, domain); mock.AssertWasCalled(x => x.Credentials = new System.Net.NetworkCredential(userName, password, domain)); }
Is there a way to verify that the setter was called with an object of type NetworkCredential and with the correct parameters?
rhino-mocks
Jon Erickson
source share