質問

私はいくつかの単体テストを書いたばかりで、私の恐怖に失敗しました。

これが私のテストです...

[TestMethod]
public void FetchWithMoreThanOneConditionUsingKnownTypes() 
{
  using (var scope = EntityObjectScopeProvider.GetNewObjectScope()) 
  {
    var temp = new TempClient() { FirstName = "Rohan", Surname = "West" }; 
    var entity = scope.Extent<ClientEntity>().Where(c => temp.FirstName == c.FirstName && temp.Surname == c.Surname).FirstOrDefault(); 

    Assert.IsNotNull(entity);
    Assert.AreEqual(entity.FirstName, temp.FirstName); 
    Assert.AreEqual(entity.Surname, temp.Surname); 
  }
}

次の例外が発生します。「Entities.Testing.TempClient」型のオブジェクトを「System.String」型にキャストできません。これは正常ですか、そうではないと思います、次のテストは正しく動作します。式の解析中に問題があると思います...これは修正されますか?

[TestMethod]
public void FetchWithMoreThanOneConditionUsingTempVariables() 
{
  using (var scope = EntityObjectScopeProvider.GetNewObjectScope()) 
  {
    var temp = new TempClient(){ FirstName = "Rohan", Surname = "West" };   

    string firstname = temp.FirstName; 
    string surname = temp.Surname; 

    var entity = scope.Extent<ClientEntity>().Where(c => c.FirstName == firstname && c.Surname == surname).FirstOrDefault(); 

    Assert.IsNotNull(entity);
    Assert.AreEqual(entity.FirstName, temp.FirstName);
    Assert.AreEqual(entity.Surname, temp.Surname); 
  }
}
役に立ちましたか?

解決

Telerikサポートに連絡した後、不可能であることが判明しました。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top