1

Web 要求「テストする URL」は、テストを実行せずに正常に完了しました。

このエラーは、asp サーバーを呼び出さないことで渡すことができます。TestMethod と CreateTest の間の行をコメントアウトします。しかし、次のエラーが表示されますか?

System.ArgumentException: 指定された名前付き接続が構成内に見つからないか、EntityClient プロバイダーでの使用を意図していないか、無効です。

テスト プロジェクトのアプリ構成ファイルには接続がありません。関連する接続文字列を挿入しようとしましたが、メイン プロジェクトから web.config もプロジェクトにコピーしましたが、それでもこのエラーが発生しますか?! ある種の偽のデータベースを使用する半分を示すいくつかのスレッドを調査しましたか? これは本当ですか; もしそうなら、誰かが私を指すことができます

    [TestMethod()]
    [HostType("ASP.NET")]
    [AspNetDevelopmentServerHost("C:\\Users\\Admin\\Documents\\Visual Studio 2010\\Projects\\CA3 EAD\\CA3 EAD", "/")]
    [UrlToTest("http://localhost:2124/")]
    public void CreateTest()
    {
        EmployeeController target = new EmployeeController(); // TODO: Initialize to an appropriate value
        Employee employee = new Employee(); // TODO: Initialize to an appropriate value
        //employee.Name = "test";
        //employee.Surname = "test";
        //employee.Town = "test"; ;
        //employee.County = "test";
        //employee.Country = "test";
        //employee.GradeID = 4;
        //ActionResult expected = target.Create(); // TODO: Initialize to an appropriate value
        //ActionResult actual = null;
        var expected = target.Create();
        var actual = target.Create(employee);
        //Assert.AreEqual(expected, actual);
        //Assert.Inconclusive("Verify the correctness of this test method.");
    }
4

1 に答える 1

0

これは私を長い間悩ませており、非常に物議を醸す問題です.

テストするEntity Framework 4.1の偽のDbContext

上記のような回答を参照してください。

于 2013-06-24T21:04:22.253 に答える