Created
October 3, 2012 20:02
-
-
Save cammerman/3829484 to your computer and use it in GitHub Desktop.
Simple.Data stored function mocking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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