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; }
public EmployeeRepository(ADONetContext context) { this.context = context; }
public MachineRepository(ADONetContext context) { this.context = context; }
public DelivererRepository(ADONetContext context) { this.context = context; }
public ADOUnitOfWork(string connectionString) { this.context = new ADONetContext(connectionString); }