这两个括号和箭头的作用是什么?
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");
}