Beispiel #1
0
    private void SetupMock(DBCommand dBCommand, Person person = null, int rows = 1)
    {
        var mock = new Mock <IDbCommand>();

        switch (dBCommand)
        {
        case DBCommand.Reader:
            mock.Setup(m => m.ExecuteReader()).Returns(MockReader(person, rows).Object).Verifiable();
            break;

        case DBCommand.ExecuteNoneQuery:
            mock.Setup(m => m.ExecuteNonQuery()).Returns(1).Verifiable();
            break;

        default:
            break;
        }

        var connectionMock = new Mock <IDbConnection>();

        connectionMock.Setup(m => m.CreateCommand()).Returns(mock.Object);

        adoConnectionFactory = new Mock <IADOConnectionFactory>();
        adoConnectionFactory.Setup(x => x.CreateConnection(It.IsAny <string>())).Returns(connectionMock.Object);

        AdoNet = new ADONetContext(adoConnectionFactory.Object, "Server=myServerName,myPortNumber;Database=myDataBase;User Id=myUsername;Password=myPassword;");
    }
 public RequestRepository(ADONetContext context)
 {
     this.context = context;
 }
Beispiel #3
0
 public EmployeeRepository(ADONetContext context)
 {
     this.context = context;
 }
 public MachineRepository(ADONetContext context)
 {
     this.context = context;
 }
Beispiel #5
0
 public DelivererRepository(ADONetContext context)
 {
     this.context = context;
 }
Beispiel #6
0
 public ADOUnitOfWork(string connectionString)
 {
     this.context = new ADONetContext(connectionString);
 }