public void LeftJoin_InferredWithMatchingSourceAndRelationProperties_MatchesExpected() { var relations = new EntityRelationSet <DataRow>() .LeftJoin(row => row.Related.RelatedId, row => row.DependencyEntity.ComplexEntityId) .Relations; var expected = new EntityRelation(EntityRelationType.LeftJoin); expected.Join <FakeRelatedRow, DependencyRow>(row => row.RelatedId, row => row.ComplexEntityId); Assert.IsNotNull(relations.FirstOrDefault(x => expected == (EntityRelation)x)); }
public void LeftJoin_EntityRelationSetWithTwoExternalRelations_MatchesExpected() { var relations = new EntityRelationSet <DataRow>().LeftJoin <FakeRelatedRow, DependencyRow>( row => row.RelatedId, row => row.FakeDependencyEntityId, "Alias").Relations; var expected = new EntityRelation(EntityRelationType.LeftJoin); expected.Join <FakeRelatedRow, DependencyRow>(row => row.RelatedId, row => row.FakeDependencyEntityId, null, "Alias"); Assert.IsNotNull(relations.FirstOrDefault(x => expected == (EntityRelation)x)); }
public void LeftJoin_InferredWithMatchingRelationProperty_MatchesExpected() { var relations = new EntityRelationSet <DataRow>() .LeftJoin(row => row.FakeDataId, row => row.Related.FakeDataId) ////.InnerJoin(row => row.Related, row => row.DependencyEntity, row => row.RelatedId, row => row.ComplexEntityId) ////.InnerJoin(row => row.OtherAlias, row => row.FakeDataId, row => row.FakeDataId) ////.InnerJoin(row => row.OtherAlias, row => row.RelatedDependency, row => row.RelatedId, row => row.ComplexEntityId) ////.InnerJoin(row => row.RelatedAlias, row => row.FakeDataId, row => row.FakeDataId) .Relations; var expected = new EntityRelation(EntityRelationType.LeftJoin); expected.Join <DataRow, FakeRelatedRow>(row => row.FakeDataId, row => row.FakeDataId); Assert.IsNotNull(relations.FirstOrDefault(x => expected == (EntityRelation)x)); }
public void InnerJoin_WithRelationAlias_MatchesExpected() { var relations = new EntityRelationSet <DataRow>() ////.InnerJoin<FakeRelatedRow>(row => row.FakeDataId, row => row.FakeDataId) ////.InnerJoin<FakeRelatedRow, DependencyRow>(row => row.RelatedId, row => row.ComplexEntityId) .InnerJoin <FakeRelatedRow>(row => row.FakeDataId, row => row.FakeDataId, "OtherAlias") ////.InnerJoin<FakeRelatedRow, DependencyRow>( //// row => row.RelatedId, //// "OtherAlias", //// row => row.ComplexEntityId, //// "RelatedDependency") ////.InnerJoin<FakeRelatedRow>(row => row.FakeDataId, row => row.FakeDataId, "RelatedAlias") .Relations; var expected = new EntityRelation(EntityRelationType.InnerJoin); expected.Join <DataRow, FakeRelatedRow>(row => row.FakeDataId, row => row.FakeDataId, null, "OtherAlias"); var actual = relations.FirstOrDefault(); Assert.AreEqual(expected, actual); }