0

次のコードを実行しようとしています:

 [TestMethod]
 [TestCleanup]
 public void TestMethod3()
 {
      using (var context = new CorporateDWTestEntities1())
      {
          //Deleting every row within the OLE_DB_Destination1 table.
          var query = from c in context.SRS_Ticket_Transaction_Stage select c;
          query.Delete();
          context.SaveChanges();
      }
 }

ただし、実行すると、次のようなエラー メッセージが表示されます。

「メッセージ: テスト メソッド Integration_Services_Tests.UnitTest1.TestMethod3 が例外をスローしました: System.Linq.Dynamic.ParseException: '.' または '(' 予期されるテスト クリーンアップ メソッド Integration_Services_Tests.UnitTest1.TestMethod3 が例外をスローしました。System.Linq.Dynamic.ParseException: System.Linq.Dynamic.ParseException:'.' または ')' が予期されます。"

これが何を意味し、それを克服する方法を知っている人はいますか?

4

1 に答える 1

0

この質問 によると、すべてのレコードをメモリにロードしてから、context.SRS_Ticket_Transaction_Stage.DeleteOnSubmit()各アイテムを呼び出す必要がある場合があります。

[TestMethod]
[TestCleanup]
public void TestMethod3()
{
    using (var context = new CorporateDWTestEntities1())
    {
        //Deleting every row within the OLE_DB_Destination1 table.
        var query = from c in context.SRS_Ticket_Transaction_Stage select c;
        var records = query.ToList();

        foreach(var record in records) 
        {
            context.SRS_Ticket_Transaction_Stage.DeleteOnSubmit(record);
        }
        context.SubmitChanges();
    }
}
于 2013-11-14T21:54:11.383 に答える