本文整理汇总了C#中Org.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Org.Add方法的具体用法?C# Org.Add怎么用?C# Org.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Org
的用法示例。
在下文中一共展示了Org.Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestLevelDown
public void TestLevelDown()
{
var parent = new Org(Guid.NewGuid()) {Name = "parentName"};
var child1 = new Org(Guid.NewGuid()) {Name = "child1"};
var child2 = new Org(Guid.NewGuid()) {Name = "child2"};
var child3 = new Org(Guid.NewGuid()) {Name = "child2"};
parent.Add(child1);
parent.Add(child2);
parent.Add(child3);
Assert.IsTrue(child2.LevelDown(child3));
Assert.AreEqual(child3, child2.Parent);
}
示例2: TestChildAddParentFaile
public void TestChildAddParentFaile()
{
var parent = new Org(Guid.NewGuid()) {Name = "parentName"};
var child1 = new Org(Guid.NewGuid()) {Name = "child1"};
var child1Child = new Org(Guid.NewGuid()) {Name = "child1child"};
var child1Child_Chidl = new Org(Guid.NewGuid()) {Name = "child1child"};
parent.Add(child1);
child1.Add(child1Child);
child1Child.Add(child1Child_Chidl);
child1Child_Chidl.Add(parent);
}
示例3: TestAddChild
public void TestAddChild()
{
var parent = new Org(Guid.NewGuid()) {Name = "parentName"};
var child1 = new Org(Guid.NewGuid()) {Name = "child1"};
var child1Child = new Org(Guid.NewGuid()) {Name = "child1child"};
child1.Add(child1Child);
Assert.AreEqual(child1.Id.ToString(), child1Child.OrderId);
Assert.AreEqual(child1, child1Child.Parent);
Assert.IsTrue(child1.Contains(child1Child));
parent.Add(child1);
Assert.AreEqual(parent.Id.ToString(), child1.OrderId);
Assert.AreEqual(parent.Id + "." + child1.Id, child1Child.OrderId);
Assert.AreEqual(parent, child1.Parent);
}
示例4: TestMappingSetting
public void TestMappingSetting()
{
var parent = new Org("Name") {Comment = "comment"};
var child = new Org("childName") {Comment = "childComment"};
var dao = new OrgDao();
dao.SaveOrUpdate(parent);
dao.Save(child);
parent.Add(child);
Org dbParent = dao.Get(parent.Id);
Assert.AreEqual(parent.Name, dbParent.Name);
Assert.AreEqual(parent.Comment, dbParent.Comment);
Assert.AreEqual(1, dbParent.OrgCount);
Org dbChild = dao.Get(child.Id);
Assert.AreEqual(parent, dbChild.Parent);
}
示例5: TestLevelDownItsChildFaile
public void TestLevelDownItsChildFaile()
{
var parent = new Org(Guid.NewGuid()) {Name = "parentName"};
var child1 = new Org(Guid.NewGuid()) {Name = "child1"};
parent.Add(child1);
Assert.IsTrue(parent.LevelDown(child1));
}
示例6: TestLevelUp
public void TestLevelUp()
{
var parent = new Org(Guid.NewGuid()) {Name = "parentName"};
var child1 = new Org(Guid.NewGuid()) {Name = "child1"};
parent.Add(child1);
Assert.IsFalse(parent.LevelUp());
Assert.IsTrue(child1.LevelUp());
Assert.IsNull(child1.Parent);
Assert.IsNull(child1.OrderId);
Assert.IsFalse(parent.Contains(child1));
}