Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple result sets with ObjectReader #58

Open
gtbuchanan opened this issue May 31, 2018 · 0 comments
Open

Add support for multiple result sets with ObjectReader #58

gtbuchanan opened this issue May 31, 2018 · 0 comments

Comments

@gtbuchanan
Copy link

I've found FastMember to be excellent for wrapping dummy data in unit tests for logic using DbDataReader. It would be great if ObjectReader supported creating a reader with multiple result sets since it is much more user-friendly than DataSet.CreateDataReader.

Current test usage example using NUnit/AutoFixture:

internal sealed class TestRow
{
    public string StringColumn { get; set; }

    public int? IntColumn { get; set; }
}

[Test, AutoData]
public void Coalesce_ReturnsDefaultNullInt(IFixture fixture, int defaultValue)
{
    var row = fixture.Build<TestRow>().Without(r => r.IntColumn).Create();
    var sut = ObjectReader.Create(new[] { row });
    sut.Read();

    var value = sut.Coalesce(nameof(row.IntColumn), defaultValue);

    Assert.That(value, Is.EqualTo(defaultValue));
}

This is obviously a very simple example using a single result set, but hopefully you can see how useful it would be to use ObjectReader with AutoFixture to generate more complex data sets without having to resort to mocking or manually building a DataSet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant