Skip to content

Instantly share code, notes, and snippets.

@cammerman
Created October 3, 2012 20:02
Show Gist options
  • Save cammerman/3829484 to your computer and use it in GitHub Desktop.
Save cammerman/3829484 to your computer and use it in GitHub Desktop.
Simple.Data stored function mocking
// test setup
var adapter = new InMemoryAdapter();
var stubId = 15;
adapter.AddFunction<int>("GenerateId", () => stubId); // A breakpoint here inside the lambda *does* break when we call it later
Database.UseMockAdapter(adapter);
dynamic db = Database.Open();
var resultId = db.GenerateId().ReturnValue;
Assert.AreEqual(stubId, resultId); // Throws here, stating that resultId is 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment