两个括号和箭头的目的是什么
service.GetDeviceLOV = () =>
我一直在试图弄清楚它的功能。下面是用于单元测试的整个方法。希望这有助于提供上下文。
//A test for GetDeviceTypes
[TestMethod()]
[HostType("Moles")]
public void GetDeviceTypesTest()
{
SetUpMoles();
Login ();
service.GetDeviceLOV = () =>
{
return new List<DeviceLOV>() {
new DeviceLOV{DeviceType = "Type 1"},
new DeviceLOV{DeviceType = "Type 2"},
new DeviceLOV {DeviceType = "Type 1"}
};
};
List<string> actual;
actual = presenter.GetDeviceTypes();
Assert.AreEqual(2, actual.Count ,"actual.Count Should = 2");
}