Pergunta

acabo de escrever alguns testes de unidade e, para meu horror que ele falhou.

Aqui está o meu teste ...

[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); 
  }
}

ele está me dando a seguinte exceção, não é possível objeto fundido do tipo 'Entities.Testing.TempClient' escrever 'System'. Isso é normal, eu espero que não, O teste a seguir funciona corretamente. Eu acho que há um problema ao analisar a expressão ... isso será corrigido?

[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); 
  }
}
Foi útil?

Solução

Depois de contatar o suporte Telerik, que acabou por não ser possível.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top