我不能測試任何註銷,登錄,從新的Microsoft Fake框架AccountController註冊操作,而沒有此錯誤消息:System.Security.VerificationException:操作可能會破壞運行時。單元測試WebMatrix.WebData與微軟虛假框架MVC4
單元測試是真實簡單:
[TestMethod]
public void LogOff()
{
var AccountController = new AccountController();
RedirectToRouteResult RedirectToRouteResult;
//Scope the detours we're creating
using (ShimsContext.Create())
{
ShimWebSecurity.Logout =() => { };
var test = AccountController.LogOff();
RedirectToRouteResult = AccountController.LogOff() as RedirectToRouteResult;
}
Assert.IsNotNull(RedirectToRouteResult);
Assert.AreEqual("Index", RedirectToRouteResult.RouteValues["Action"]);
Assert.AreEqual("Home", RedirectToRouteResult.RouteValues["controller"]);
}
也覺得這樣的:http://social.msdn.microsoft.com/Forums/en-US/vsunittest/thread/f84962ea-a9b2-4e0d-873b-e3cf8cfb37e2是談論同樣的錯誤,但無人接聽。
謝謝!
更新2,同樣的錯誤。微軟破壞我的運行時間 – felickz 2013-03-14 14:23:35
@felickz我剛剛測試更新2,它工作正常。我幾天前安裝了更新2,並認爲我可能會給它一個鏡頭。沒有VerificationExceptions。 – 2013-04-08 17:12:52
瘋了我沒有更新2安裝在我使用的機器上。太多的開發機器:) – felickz 2013-05-22 13:45:22