markrendle/Simple.Data — Issue #134: Simple.Data.Mocking does not allow anything but "Id" as key for table row
Author: mathewrphillips
Created: 2011-12-21 05:43:31+00:00
State: open

The following code does not work with the latest nuget package of Simple.Data.Mocking. The value of "result" is always null. Is it possible to have a value for _keys that isn't "Id" and still make the XmlMockAdapter work correctly? By changing all references of UrlId to just Id, the code below does work; however, I feel like it should still be able to work by specifying the correct _keys value for my schema.

[TestFixtureSetUp]
public void MockUrlRepositoryInitialize()
{
_mockAdapter = new XmlMockAdapter(
@"

");

MockHelper.UseMockAdapter(_mockAdapter);
repo = new UrlRepository(Database.Open());
}

[Test]
public void TestMethod()
{
var result = repo.GetUrl(1);
Assert.IsNotNull(result);
}

(in UrlRepository class def)

public dynamic GetUrl(id)
{
var result = _db.Urls.FindByUrlId(id) // also tried _db.Urls.FindBy(UrlId: id) but that returned null as well
return result;
}