Khi tôi chạy Bài kiểm tra Đơn vị, tất cả các bài kiểm tra đều vượt qua, nhưng thay vì "Chạy thử thành công" hoặc bất kỳ thông báo thành công nào, tôi nhận được "Lỗi chạy thử" trong thanh nhỏ cho tôi biết bao nhiêu bài kiểm tra của tôi đã vượt qua, mặc dù tất cả các bài kiểm tra của tôi đã trôi qua.Kiểm tra lỗi chạy với MSTest trong VS2010
Khi tôi nhấp vào văn bản, tôi được đưa đến một trang đó nói với tôi hai điều sau đây xảy ra:
Warning: conflict during test run deployment: deployment item '[...]\Booking.Web.dll' directly or indirectly referenced by the test container [...]\Booking.Web.Tests.dll cannot be deployed to 'Booking.Web.dll' because otherwise the file '[...]\Booking.Web.dll' would override deployment item '[...]\Booking.Web.dll' directly or indirectly referenced by '[...]\Booking.Web.Tests.dll'
Error: Cannot initialize the ASP.NET project 'Booking.Web' Exception was thrown: The website could not be configured correctly; getting ASP.NET proccess information failed. Requesting ' http://localhost:54131/VSEnterpriseHelper.axd ' returned an error: The remote server returned an error: (500) Internal Server Error.
Tôi không hiểu một nửa của những gì nó đang phàn nàn về. Làm thế nào để loại bỏ các lỗi này?
(Và để tham khảo: Booking.Web là một dự án ASP.NET MVC 2, Booking.Web.Tests là một dự án thử nghiệm, [...] là đường dẫn đầy đủ địa phương cho các dự án trong môi trường của tôi, trong hầu hết của các trường hợp ở trên vào thư mục/bin/debug/bên trong dự án Booking.Web)
Cập nhật: Theo hướng dẫn, tôi tìm kiếm thêm thông tin trong Trình xem sự kiện. Dưới đây là những gì tôi đã tìm thấy:
3008 A configuration error has occurred.
5/8/2010 2:26:15 AM
5/8/2010 12:26:15 AM
4ffbe9180c3d4c02adb9ac4d61dd0928
1
1
0
4484bbf4-1-129177519750954331
Full
/
D:\...\Booking.Web\
AASLOEG1876
WebDev.WebServer40.EXE
Aasloeg\Tomas
ConfigurationErrorsException
Could not load file or assembly 'Ninject.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=79764a4ef1548af1' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045) at
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) at
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() at
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) at
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) at
...stack trace in absurdum.
Tham khảo một dự án ASP.NET trong một thử nghiệm đơn vị là hầu như luôn luôn một ý tưởng tồi. –
OK ... Vậy làm thế nào tôi nên refactor để có được ra khỏi điều này? –
Refferencing ASP.NET MVC project trong một unit test là một thực tế phổ biến. Nếu không thì làm thế nào bạn sẽ kiểm tra hành động của bộ điều khiển? –