1

I have just written a few unit tests and to my horror it failed.

Here is my 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); 
  }
}

it is giving me the following exception, Unable to cast object of type 'Entities.Testing.TempClient' to type 'System.String'. Is this normal, i hope not, The following test works correctly. I guess there is a problem when parsing the expression... Will this be fixed?

[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); 
  }
}
Rohan West
  • 9,262
  • 3
  • 37
  • 64
  • If you have a tech support request you should go the Telerik forums. They will probably be more helpful. – Jason Short May 07 '09 at 03:20
  • Thats is a very good idea, i have posted a question there too. I was just wondering if anyone else has had this problem and if so how did they solve it? Do you have to add any specific configuration to the app.config or is this just a bug... – Rohan West May 07 '09 at 03:49
  • looks like *another* Telerik bug. did they ever answer you on their support forum? I am not impressed with their ORM at all. *big thumbs down* – D3vtr0n Sep 08 '09 at 23:07

1 Answers1

1

After contacting Telerik support, it turned out not to be possible.

Rohan West
  • 9,262
  • 3
  • 37
  • 64