Skip to content

Instantly share code, notes, and snippets.

@tallseth
Created December 20, 2011 03:37
Show Gist options
  • Save tallseth/1500120 to your computer and use it in GitHub Desktop.
Save tallseth/1500120 to your computer and use it in GitHub Desktop.
Entity framework unit test problem
//works
public void Update(Job job)
{
//How do you unit test this line without communicating with a DB?
context_.Entry(job).State = EntityState.Modified;
context_.SaveChanges();
}
//doesn't work
public void Update(Job job)
{
//Can I make sure it doesn't get turned into this?
context_.Entry(job).State = EntityState.Deleted;
context_.SaveChanges();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment