Skip to content

Instantly share code, notes, and snippets.

@Buildstarted
Created February 7, 2014 23:20
Show Gist options
  • Save Buildstarted/8873975 to your computer and use it in GitHub Desktop.
Save Buildstarted/8873975 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DbExecutorTests
{
using System.Data;
using DapperWrapper;
using Moq;
public class DbExecutorTests
{
[Test]
public void QueryDoesNotReturnNull()
{
const string query = "blah";
var mock = new Mock<IDbExecutor>();
mock.Setup(f => f.Query<Address>(It.IsAny<string>(), null, null, true, null, null))
.Returns(new List<Address>
{
new Address()
});
var result = mock.Object.Query<Address>(query).ToList();
Assert.IsNotNull(result);
mock.Verify(x => x.Query<Address>(It.IsAny<string>(), null, null, true, null, null), Times.Once);
}
private List<Address> RunQuery(IDbExecutor executor)
{
var blah = executor;
return blah.Query<Address>("blah").ToList();
}
}
public class Address { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment