本文整理汇总了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);
}
示例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());
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}