Domanda

Ho appena scritto alcuni test unitari e con mio orrore è fallito.

Ecco il mio test ...

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

mi sta dando la seguente eccezione, Impossibile lanciare un oggetto di tipo 'Entities.Testing.TempClient' per digitare 'System.String'. È normale, spero di no, il seguente test funziona correttamente. Immagino che ci sia un problema nell'analisi dell'espressione ... Sarà risolto?

[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); 
  }
}
È stato utile?

Soluzione

Dopo aver contattato l'assistenza di Telerik, non è stato possibile.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top