0
我正在嘗試運行此係統測試。我確信設備信息在數據庫中。系統測試運行錯誤信息
當我運行它不斷給我一個錯誤消息的測試:
試驗方法SystemTests.Tests.EmailNotification.TestAddDeviceToAccount 拋出異常:System.InvalidOperationException:序列包含 任何元素。
任何幫助,請
public void TestAddDeviceToAccount()//Test to AssDeviceToAccount
{
//string Fccid = "OPS2";
//string SerialNumber = "101";
//string emailAddress = "[email protected]";
using (WSPlusEntities dc = WSPlusEntities.GetContext())
{
Device d1 = dc.Devices.Where(d => d.FCCID == "OPS2" && d.SerialNumber == "101").Single();
d1.NetworkId = 1;
//var deviceList = dc1.Devices.Where(d => d.FCCID == "OPS2" && d.SerialNumber == "102").ToList();
//foreach (var d2 in deviceList)
//d2.NetworkId = 1;
dc.SaveChanges();
}
}
檢查'dc.Devices'中的值。它很可能是空的。 –