Reputation: 5090
This is the exact representation of a WCF interface and class that I have.
I would like to know how to write a NUnit test for this... using the interface for mocking.
The main thing is I am NOT looking to add a service reference for the WCF service integration test. But some thing more concentrated for the unit testing part. Specifically to test the ProcessStuff method.
namespace CompanyName.Services.ProcessStuff {
public class ProcessStuffService : IProcessStuff
{
public string ProcessStuff(string input)
{
ISomeOtherInterface ProcessManager = new ProcessManager();
return ProcessManager.ProcessStuff(input);
}
}
}
namespace CompanyName.Common.FacadeInterfaces
{
[ServiceContract(Namespace = "com.companyname.services", Name = "Process Stuff Service")]
public interface IProcessStuff
{
[OperationContract(Name = "ProcessStuff")]
string ProcessStuff(string input);
}
}
Upvotes: 0
Views: 890
Reputation: 250932
Okay, I might have mis-read the question, so feel free to clarify.
If the method under test is:
ProcessManager.ProcessStuff(input)
The IProcessStuff interface is irrelevant. You would create a new Process Manager and call this method.
// You would pass mocks IN to the process manager if it required them here...
var processManager = new ProcessManager();
var result = processManager.ProcessStuff(testInput);
Assert.IsNotNull(result);
So in this case, I cannot see what Interface you want to mock.
Upvotes: 1