Created
February 7, 2014 23:20
-
-
Save Buildstarted/8873975 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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