【发布时间】:2011-01-31 19:35:59
【问题描述】:
这是我拥有的 WCF 接口和类的精确表示。
我想知道如何为此编写一个 NUnit 测试...使用模拟接口。
主要是我不想为 WCF 服务集成测试添加服务引用。但是单元测试部分更集中一些东西。专门用来测试 ProcessStuff 方法。
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);
}
}
【问题讨论】:
标签: c# wcf unit-testing nunit mocking