代码合同在Windows Phone 8单元测试中不起作用

时间:2013-06-06 21:49:19

标签: .net visual-studio unit-testing windows-phone-8 windows-phone

当我的单元测试运行具有Contract的方法时,<>,它失败并出现错误:

An exception occurred while invoking executor 'executor://mswptestadapter/v1': Object reference not set to an instance of an object.
========== Run test finished: 0 run (0:00:28.8388006) ==========

这是pxproj文件中的合同设置。

    <CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking>
    <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
    <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
    <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
    <CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
    <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
    <CodeContractsNonNullObligations>True</CodeContractsNonNullObligations>
    <CodeContractsBoundsObligations>True</CodeContractsBoundsObligations>
    <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
    <CodeContractsEnumObligations>False</CodeContractsEnumObligations>
    <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
    <CodeContractsMissingPublicRequiresAsWarnings>True</CodeContractsMissingPublicRequiresAsWarnings>
    <CodeContractsInferRequires>True</CodeContractsInferRequires>
    <CodeContractsInferEnsures>False</CodeContractsInferEnsures>
    <CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
    <CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
    <CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
    <CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
    <CodeContractsRunInBackground>True</CodeContractsRunInBackground>
    <CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
    <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
    <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
    <CodeContractsCustomRewriterAssembly />
    <CodeContractsCustomRewriterClass />
    <CodeContractsLibPaths />
    <CodeContractsExtraRewriteOptions />
    <CodeContractsExtraAnalysisOptions />
    <CodeContractsSQLServerOption />
    <CodeContractsBaseLineFile />
    <CodeContractsCacheAnalysisResults>True</CodeContractsCacheAnalysisResults>
    <CodeContractsFailBuildOnWarnings>False</CodeContractsFailBuildOnWarnings>
    <CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
    <CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
    <CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>