public void TestFindBy() { var support = new TestDatabaseSupport(_dataSourceConfig); support.ExecSql(@" insert into users (id, name) values (12, 'Jack'); insert into accounts (id, owner_id, name) values (1, 12, 'anAccount'); "); var gateway = new AccountDataGateway(new DatabaseTemplate(_dataSourceConfig)); var actual = gateway.FindBy(12); Assert.Equal(1, actual.Id); Assert.Equal(12, actual.OwnerId); Assert.Equal("anAccount", actual.Name); }
public void TestFindBy() { Support.ExecSql(@" insert into users (id, name) values (12, 'Jack'); insert into accounts (id, owner_id, name) values (1, 12, 'anAccount'), (2, 12, 'anotherAccount'); "); var gateway = new AccountDataGateway(new AccountContext(DbContextOptions)); var actual = gateway.FindBy(12); Assert.Equal(1, actual[0].Id); Assert.Equal(12, actual[0].OwnerId); Assert.Equal("anAccount", actual[0].Name); Assert.Equal(2, actual[1].Id); Assert.Equal(12, actual[1].OwnerId); Assert.Equal("anotherAccount", actual[1].Name); }