当前位置: 首页>>代码示例>>C#>>正文


C# Source.MergeWith方法代码示例

本文整理汇总了C#中Source.MergeWith方法的典型用法代码示例。如果您正苦于以下问题:C# Source.MergeWith方法的具体用法?C# Source.MergeWith怎么用?C# Source.MergeWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Source的用法示例。


在下文中一共展示了Source.MergeWith方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestMergeWith_IncludesInheritanceJoinFields

        public void TestMergeWith_IncludesInheritanceJoinFields()
        {
            //-------------Setup Test Pack ------------------
            Source originalSource = new Source("FromSource", "FromSourceEntity");
            Source otherSource = new Source("FromSource", "FromSourceEntity");
            Source childSource = new Source("ToSource", "ToSourceEntity");
            Source.Join join = new Source.Join(otherSource, childSource);
            QueryField field1 = new QueryField("FromSourceProp1", "FromSourceProp1Field", otherSource);
            QueryField field2 = new QueryField("ToSourceProp1", "ToSourceProp1Field", childSource);
            otherSource.InheritanceJoins.Add(join);
            join.JoinFields.Add(new Source.Join.JoinField(field1, field2));

            //-------------Execute test ---------------------
            originalSource.MergeWith(otherSource);

            //-------------Test Result ----------------------
            Assert.AreEqual(1, originalSource.InheritanceJoins.Count);
            Assert.AreEqual(1, originalSource.InheritanceJoins[0].JoinFields.Count);
            Assert.AreEqual(field1, originalSource.InheritanceJoins[0].JoinFields[0].FromField);
            Assert.AreEqual(field2, originalSource.InheritanceJoins[0].JoinFields[0].ToField);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:21,代码来源:TestSource.cs

示例2: Test_MergeTwoSources_CheckThatSecondMergeDoesntAffectSourceOfFirstField

        public void Test_MergeTwoSources_CheckThatSecondMergeDoesntAffectSourceOfFirstField()
        {
            //---------------Set up test pack-------------------
            Source originalSource = new Source("Allegation", "Allegation");

            Source receivedDateSource1 = new Source("Allegation");
            receivedDateSource1.JoinToSource(new Source("Request"));

            Source institutionSource = new Source("Allegation");
            Source reqSource = new Source("Request");
            reqSource.JoinToSource(new Source("Institution"));
            institutionSource.JoinToSource(reqSource);

            QueryField receivedDate1Field = new QueryField("ReceivedDate", "ReceivedDate", receivedDateSource1);
            QueryField institutionField = new QueryField("Name", "Name", institutionSource);

            originalSource.MergeWith(receivedDate1Field.Source);

            //---------------Assert preconditions---------------
            Assert.AreEqual("Allegation.Request", receivedDate1Field.Source.ToString());
            Assert.AreEqual("Allegation.Request.Institution", institutionField.Source.ToString());
            //---------------Execute Test ----------------------
            originalSource.MergeWith(institutionField.Source);
            //---------------Test Result -----------------------
            Assert.AreEqual("Allegation.Request", receivedDate1Field.Source.ToString());
            Assert.AreEqual("Allegation.Request.Institution", institutionField.Source.ToString());
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:27,代码来源:TestSource.cs

示例3: TestMergeWith_EqualSource_DifferentChildSources

        public void TestMergeWith_EqualSource_DifferentChildSources()
        {
            //-------------Setup Test Pack ------------------
            Source originalSource = new Source("FromSource", "FromSourceEntity");
            originalSource.JoinToSource(new Source("ToSource", "ToSourceEntity"));
            Source otherSource = new Source("FromSource", "FromSourceEntity");
            Source childSource = new Source("ToSource", "ToSourceEntity");
            childSource.JoinToSource(new Source("GrandchildSource", "GrandchildSourceEntity"));
            otherSource.JoinToSource(childSource);
            //-------------Test Pre-conditions --------------

            //-------------Execute test ---------------------
            originalSource.MergeWith(otherSource);
            //-------------Test Result ----------------------
            Assert.AreEqual(1, originalSource.Joins.Count);
            Assert.AreEqual(1, originalSource.ChildSource.Joins.Count);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:17,代码来源:TestSource.cs

示例4: TestMergeWith_TwoLevels

        public void TestMergeWith_TwoLevels()
        {
            //-------------Setup Test Pack ------------------
            Source originalSource = new Source("FromSource", "FromSourceEntity");
            Source otherSource = new Source("FromSource", "FromSourceEntity");
            Source childSource = new Source("ChildSource", "ChildSourceEntity");
            Source grandchildSource = new Source("GrandChildSource", "GrandchildSourceEntity");
            childSource.JoinToSource(grandchildSource);
            otherSource.JoinToSource(childSource);

            //-------------Execute test ---------------------
            originalSource.MergeWith(otherSource);

            //-------------Test Result ----------------------
            Assert.AreSame(grandchildSource.ToString(), originalSource.ChildSource.ChildSource.ToString());
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:16,代码来源:TestSource.cs

示例5: TestMergeWith_Simple

        public void TestMergeWith_Simple()
        {
            //-------------Setup Test Pack ------------------
            Source fromSource = new Source("FromSource", "FromSourceEntity");
            Source otherSource = new Source("FromSource", "FromSourceEntity");
            otherSource.JoinToSource(new Source("ToSource", "ToSourceEntity"));

            //-------------Execute test ---------------------
            fromSource.MergeWith(otherSource);
            //-------------Test Result ----------------------
            Assert.AreSame(fromSource.ChildSource.ToString(), otherSource.ChildSource.ToString());
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:12,代码来源:TestSource.cs

示例6: TestMergeWith_NullSource

        public void TestMergeWith_NullSource()
        {
            //-------------Setup Test Pack ------------------
            Source fromSource = new Source("FromSource", "FromSourceEntity");

            //-------------Execute test ---------------------
            fromSource.MergeWith(null);
            //-------------Test Result ----------------------
            Assert.AreEqual(0, fromSource.Joins.Count);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:10,代码来源:TestSource.cs

示例7: TestMergeWith_EmptySource

        public void TestMergeWith_EmptySource()
        {
            //-------------Setup Test Pack ------------------
            Source fromSource = new Source("FromSource", "FromSourceEntity");
            Source otherSource = new Source("", "FromSourceEntity");
            otherSource.JoinToSource(new Source("ToSource", "ToSourceEntity"));

            //-------------Execute test ---------------------
            fromSource.MergeWith(otherSource);
            //-------------Test Result ----------------------
            Assert.AreEqual(0, fromSource.Joins.Count);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:12,代码来源:TestSource.cs


注:本文中的Source.MergeWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。