为什么这个NUnit测试失败了?

时间:2014-07-07 18:19:35

标签: c# httpwebrequest nunit webrequest nunit-2.6

这是问题here

的“扩展”

我现在正在运行两个Visual Studio /解决方案实例。我启动一个,然后在另一个中访问此测试的上下文菜单:

public enum HttpMethods
{
    GET = 0,
    PUT,
    POST,
    DELETE,
    HEAD,
    OPTIONS,
    LIST,
    UNKNOWN
}

[Test]
public HttpWebRequest TestHHSDeliveryItemInterfacePostPPTData()
{
    var DeliveryItem = IOC.container.Resolve<IHHSDeliveryItem>();

    string data = @"<note>
                        <to>Tove</to>
                        <from>Jani</from>
                        <heading>Reminder</heading>
                        <body>Don't forget me this weekend!</body>
                    </note>";
    string uri = "http://localhost:21609/api/deliveryitems/InsertIntoPPTData";
    WebRequest request = WebRequest.Create(uri);
    request.Method =  //Enum.ToObject(typeof(HttpMethods), HHTPMethods.).ToString();
    request.ContentType = "application/json";
    ((HttpWebRequest)request).Accept = request.ContentType;
    ((HttpWebRequest)request).KeepAlive = false;
    ((HttpWebRequest)request).ProtocolVersion = HttpVersion.Version10;

    Encoding encoding = Encoding.UTF8; // never used
    byte[] arrData = Encoding.UTF8.GetBytes(data);
    request.ContentLength = arrData.Length;
    using (Stream oS = request.GetRequestStream())
    {
        oS.Write(arrData, 0, arrData.Length);
    }

    if (DeliveryItem.InsertIntoPPTData((HttpWebRequest)request))
    {
        return request as HttpWebRequest;
    }
    else
    {
        return null;
    }
}

...并选择“调试测试”。然而,悲惨的是,我(再次)从未到达我设置的断点(在上面的第一行,“DeliveryItem”的赋值)。然后使用以下logsam和dumpsam填充“输出”窗格:

'vstest.executionengine.x86.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\Microsoft.Net\assembly
\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\vstest.executionengine.x86.exe'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Microsoft.VisualStudio.TestPlatform.Core.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel
\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization
\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\SMDiagnostics\v4.0_4.0.0.0__b77a5c561934e089\SMDiagnostics.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Internals
\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Internals.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.ServiceModelSink
\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel
\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll'. 
Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Microsoft.VisualStudio.TestPlatform.Utilities.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.Measurement\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.Measurement.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.GenericTestAdapter.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.UnitTestFramework.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.MSPhoneAdapter.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.OrderedTestAdapter.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.TfsLogger.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.TmiAdapter.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Common\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Common.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestTools.CppUnitTestFramework.ComInterfaces.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\Extensions\Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppPhoneUnitTestExtension.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.Composition
\v4.0_4.0.0.0__b77a5c561934e089\System.ComponentModel.Composition.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\Extensions\Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Users\clay\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnitTestAdapter.1.0\lib\NUnit.VisualStudio.TestAdapter.dll'. 
Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Users\clay\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnitTestAdapter.1.0\lib\nunit.core.interfaces.dll'. Module was built without symbols.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Users\clay\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnitTestAdapter.1.0\lib\nunit.util.dll'. Module was built without symbols.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Users\clay\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnitTestAdapter.1.0\lib\nunit.core.dll'. Module was built without symbols.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Domain 2): Loaded 'C:\Windows\Microsoft.Net\assembly
\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Loaded 'C:\Users\clay\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnitTestAdapter.1.0\lib\nunit.core.dll'. Module was built without symbols.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Cannot find or open the PDB file.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Loaded 'C:\Users\clay\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnitTestAdapter.1.0\lib\nunit.core.interfaces.dll'. Module was built without symbols.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Loaded 'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\5280_635403276502133355\Tests_11081234\assembly\dl3\ed8d1526\6266a85f_0d9acf01\HHS.Web.Tests.dll'. Symbols loaded.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Loaded 'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\5280_635403276502133355\Tests_11081234\assembly\dl3\aef8b6df\f8a3911b_1f92cf01\nunit.framework.dll'. Module was built without symbols.
'vstest.executionengine.x86.exe' (CLR v4.0.30319: vstest.executionengine.x86.exe): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
\msdia120typelib_clr0200.dll'. Cannot find or open the PDB file.
The thread 0x3bf4 has exited with code 259 (0x103).
The thread 0x2a0c has exited with code 259 (0x103).
'vstest.executionengine.x86.exe' (CLR v4.0.30319: Domain 2): Unloaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Unloaded 'C:\Users\clay\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnitTestAdapter.1.0\lib\nunit.core.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Unloaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Unloaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Unloaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Unloaded 'C:\Users\clay\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnitTestAdapter.1.0\lib\nunit.core.interfaces.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Unloaded 'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\5280_635403276502133355\Tests_11081234\assembly\dl3\ed8d1526\6266a85f_0d9acf01\HHS.Web.Tests.dll'
'vstest.executionengine.x86.exe' (CLR v4.0.30319: test-domain-HHS.Web.Tests.dll): Unloaded 'C:\Users\clay\AppData\Local\Temp\nunit20\ShadowCopyCache\5280_635403276502133355\Tests_11081234\assembly\dl3\aef8b6df\f8a3911b_1f92cf01\nunit.framework.dll'
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll
The thread 0x2b7c has exited with code 259 (0x103).
A first chance exception of type 'System.InvalidOperationException' occurred in 

Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll
The thread 0x2344 has exited with code 259 (0x103).
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectbortedException' occurred in System.ServiceModel.Internals.dll
A first chance exception of type 'System.IO.IOException' occurred in System.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.Internals.dll
A first chance exception of type 'System.ServiceModel.CommunicationObjectAbortedException' occurred in System.ServiceModel.Internals.dll
A first chance exception of type 'System.InvalidOperationException' occurred in 
Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll
The program '[5280] vstest.executionengine.x86.exe: Program Trace' has exited with code 0 (0x0).
The program '[5280] vstest.executionengine.x86.exe' has exited with code 0 (0x0).

注意:我能够以这种方式成功运行简单的测试;这个问题出于某种原因......

更新

好吧,这真是奇怪:编译的代码,即使作业被注释掉了。现在是:

request.Method = Enum.ToObject(typeof(HttpMethods), HttpMethods.POST).ToString();

更新2

我用void替换了方法的返回类型,最后用if / else块替换了:

Assert.IsNotNull(request);

更新3

我忘记添加实际发送请求的代码行(它对我的工作方式似乎并不真实透明),所以在使用块写入流后我现在有:

WebResponse response = request.GetResponse();
Assert.IsNotNull(response);

...但我仍然有一个时代,如果不是史诗般的失败:

。 。 。 mscorlib.dll中发生了'System.IO.IOException'类型的第一次机会异常 线程0x3114已退出代码259(0x103)。 Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll中出现“System.InvalidOperationException”类型的第一次机会异常 System.ServiceModel.dll中发生了'System.ServiceModel.CommunicationObjectAbortedException'类型的第一次机会异常 线程0x3d7c已退出代码259(0x103)。 Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll中出现“System.InvalidOperationException”类型的第一次机会异常 程序'[12252] vstest.executionengine.x86.exe:Program Trace'已退出,代码为0(0x0)。 程序'[12252] vstest.executionengine.x86.exe'已退出,代码为0(0x0)。

0 个答案:

没有答案
相关问题