private CodeFile GeneratePagedSelectByRelatedTypeFunction(ApplicationType type, Field field, Domain domain) { var adapter = new SelectPagedByFieldsDbTypeAdapter(type, $"select_paged_by_{field.Name}", new List <Field> { field }, OperationType.Select, domain); return(GenerateTemplateFromAdapter(adapter, "SelectPagedByForeignKey")); }
public void SelectFieldsAreReturnedWithIndex() { var domain = TestUtil.CreateTestDomain(new MockFileSystem()); var orderType = domain.Types.Single(t => t.Name == "order"); var adapter = new SelectPagedByFieldsDbTypeAdapter(orderType, "test", new List <Field>(orderType.Fields), OperationType.Select, domain); adapter.SelectFieldsWithIndices.Count.Should().BeGreaterThan(1); for (var i = 0; i < adapter.SelectFieldsWithIndices.Count; i++) { adapter.SelectFieldsWithIndices[i].Index.Should().Be(i + 1); } }