3
我正在做一些單元測試,並不確定爲什麼這個特定的測試失敗。MSTest Assert.AreEqual失敗,字符串數組
該測試旨在聲明自定義視圖引擎在正確位置查找視圖。
以我的自定義視圖發動機是這樣的:
AreaMasterLocationFormats = new[]
{
"~/Areas/{2}/App/{1}/Views/{0}.cshtml",
"~/Areas/{2}/App/Shared/Views/{0}.cshtml"
};
而在我的試驗是這樣的:
string[] expected = new[]
{
"~/Areas/{2}/App/{1}/Views/{0}.cshtml",
"~/Areas/{2}/App/Shared/Views/{0}.cshtml"
};
CustomRazorViewEngine engine = new CustomRazorViewEngine();
Assert.AreEqual(expected, engine.AreaMasterLocationFormats);
測試失敗並顯示消息:
Message: Assert.AreEqual failed. Expected:<System.String[]>. Actual:<System.String[]>.
(S/o的報價格式不喜歡第二個lt ...)
我不確定爲什麼,因爲當我調試測試都顯得很好。
不知道爲什麼你刪除你的答案(誰你),但它是正確的... – jleach
有那麼一瞬間,我沒'確定'string []'實際上是一個'Collection'。 – haim770
@ haim770顯然,看到測試如何通過現在:)我會除了當我的計時器了,謝謝。 – jleach