本文整理汇总了C#中Domain.AddDirectSuperdomain方法的典型用法代码示例。如果您正苦于以下问题:C# Domain.AddDirectSuperdomain方法的具体用法?C# Domain.AddDirectSuperdomain怎么用?C# Domain.AddDirectSuperdomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain.AddDirectSuperdomain方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CircularSuperDomains
public void CircularSuperDomains()
{
var metaPopulation = new MetaPopulation();
var domain = new Domain(metaPopulation, Guid.NewGuid()) { Name = "Domain" };
var superdomain = new Domain(metaPopulation, Guid.NewGuid()) { Name = "Superdomain" };
domain.AddDirectSuperdomain(superdomain);
var exceptionThrown = false;
try
{
superdomain.AddDirectSuperdomain(domain);
}
catch
{
exceptionThrown = true;
}
Assert.AreEqual(true, exceptionThrown);
exceptionThrown = false;
try
{
domain.AddDirectSuperdomain(domain);
}
catch
{
exceptionThrown = true;
}
Assert.AreEqual(true, exceptionThrown);
}
示例2: Composites
public void Composites()
{
var metaPopulation = new MetaPopulation();
var domain = new Domain(metaPopulation, Guid.NewGuid());
var superdomain = new Domain(metaPopulation, Guid.NewGuid());
domain.AddDirectSuperdomain(superdomain);
Assert.AreEqual(0, metaPopulation.Composites.Count());
var @class = new ClassBuilder(domain, Guid.NewGuid()).WithSingularName("Class").WithPluralName("Classes").Build();
Assert.AreEqual(1, metaPopulation.Composites.Count());
var superclass = new ClassBuilder(superdomain, Guid.NewGuid()).WithSingularName("Superclass").WithPluralName("Superclasses").Build();
Assert.AreEqual(2, metaPopulation.Composites.Count());
var @interface = new InterfaceBuilder(domain, Guid.NewGuid()).WithSingularName("i1").WithPluralName("i1s").Build();
Assert.AreEqual(3, metaPopulation.Composites.Count());
var superinterface = new InterfaceBuilder(superdomain, Guid.NewGuid()).WithSingularName("i2").WithPluralName("i2s").Build();
Assert.AreEqual(4, metaPopulation.Composites.Count());
var unit = new UnitBuilder(domain, UnitIds.StringId).WithSingularName("AllorsString").WithPluralName("AllorsStrings").WithUnitTag(UnitTags.AllorsString).Build();
Assert.AreEqual(4, metaPopulation.Composites.Count());
var superunit = new UnitBuilder(domain, UnitIds.IntegerId).WithSingularName("AllorsInteger").WithPluralName("AllorsIntegers").WithUnitTag(UnitTags.AllorsString).Build();
Assert.AreEqual(4, metaPopulation.Composites.Count());
}
示例3: Create
public void Create()
{
var metaPopulation = new MetaPopulation();
var domain = new Domain(metaPopulation, Guid.NewGuid()) { Name = "Domain" };
var validationReport = this.MetaPopulation.Validate();
Assert.IsFalse(validationReport.ContainsErrors);
Assert.AreEqual(1, metaPopulation.Domains.Count());
Assert.AreEqual(0, domain.DirectSuperdomains.Count());
var superdomain = new Domain(metaPopulation, Guid.NewGuid()) { Name = "Superdomain" };
Assert.AreEqual(2, metaPopulation.Domains.Count());
domain.AddDirectSuperdomain(superdomain);
Assert.AreEqual(2, metaPopulation.Domains.Count());
Assert.AreEqual(1, domain.DirectSuperdomains.Count());
Assert.AreEqual(0, superdomain.DirectSuperdomains.Count());
}
示例4: Find
public void Find()
{
var metapopulation = new MetaPopulation();
var domain = new Domain(metapopulation, Guid.NewGuid());
var superdomain = new Domain(metapopulation, Guid.NewGuid());
domain.AddDirectSuperdomain(superdomain);
var unitId = UnitIds.StringId;
var interfaceId = Guid.NewGuid();
var classId = Guid.NewGuid();
var inheritanceId = Guid.NewGuid();
var relationTypeId = Guid.NewGuid();
var associationTypeId = Guid.NewGuid();
var roleTypeId = Guid.NewGuid();
var superunitId = UnitIds.IntegerId;
var superinterfaceId = Guid.NewGuid();
var superclassId = Guid.NewGuid();
var superinheritanceId = Guid.NewGuid();
var superrelationTypeId = Guid.NewGuid();
var superassociationTypeId = Guid.NewGuid();
var superroleTypeId = Guid.NewGuid();
Assert.IsNull(metapopulation.Find(unitId));
Assert.IsNull(metapopulation.Find(interfaceId));
Assert.IsNull(metapopulation.Find(classId));
Assert.IsNull(metapopulation.Find(inheritanceId));
Assert.IsNull(metapopulation.Find(relationTypeId));
Assert.IsNull(metapopulation.Find(associationTypeId));
Assert.IsNull(metapopulation.Find(roleTypeId));
Assert.IsNull(metapopulation.Find(superunitId));
Assert.IsNull(metapopulation.Find(superinterfaceId));
Assert.IsNull(metapopulation.Find(superclassId));
Assert.IsNull(metapopulation.Find(superinheritanceId));
Assert.IsNull(metapopulation.Find(superrelationTypeId));
Assert.IsNull(metapopulation.Find(superassociationTypeId));
Assert.IsNull(metapopulation.Find(superroleTypeId));
new UnitBuilder(domain, unitId).WithSingularName("AllorsString").WithPluralName("AllorsStrings").WithUnitTag(UnitTags.AllorsString).Build();
Assert.IsNotNull(metapopulation.Find(unitId) as Unit);
Assert.IsNull(metapopulation.Find(interfaceId));
Assert.IsNull(metapopulation.Find(classId));
Assert.IsNull(metapopulation.Find(inheritanceId));
Assert.IsNull(metapopulation.Find(relationTypeId));
Assert.IsNull(metapopulation.Find(associationTypeId));
Assert.IsNull(metapopulation.Find(roleTypeId));
Assert.IsNull(metapopulation.Find(superunitId));
Assert.IsNull(metapopulation.Find(superinterfaceId));
Assert.IsNull(metapopulation.Find(superclassId));
Assert.IsNull(metapopulation.Find(superinheritanceId));
Assert.IsNull(metapopulation.Find(superrelationTypeId));
Assert.IsNull(metapopulation.Find(superassociationTypeId));
Assert.IsNull(metapopulation.Find(superroleTypeId));
var @interface = new InterfaceBuilder(domain, interfaceId).WithSingularName("Interface").WithPluralName("Interfaces").Build();
Assert.IsNotNull(metapopulation.Find(unitId) as Unit);
Assert.IsNotNull(metapopulation.Find(interfaceId) as Interface);
Assert.IsNull(metapopulation.Find(classId));
Assert.IsNull(metapopulation.Find(inheritanceId));
Assert.IsNull(metapopulation.Find(relationTypeId));
Assert.IsNull(metapopulation.Find(associationTypeId));
Assert.IsNull(metapopulation.Find(roleTypeId));
Assert.IsNull(metapopulation.Find(superunitId));
Assert.IsNull(metapopulation.Find(superinterfaceId));
Assert.IsNull(metapopulation.Find(superclassId));
Assert.IsNull(metapopulation.Find(superinheritanceId));
Assert.IsNull(metapopulation.Find(superrelationTypeId));
Assert.IsNull(metapopulation.Find(superassociationTypeId));
Assert.IsNull(metapopulation.Find(superroleTypeId));
var @class = new ClassBuilder(domain, classId).WithSingularName("Class").WithPluralName("Classes").Build();
Assert.IsNotNull(metapopulation.Find(unitId) as Unit);
Assert.IsNotNull(metapopulation.Find(interfaceId) as Interface);
Assert.IsNotNull(metapopulation.Find(classId) as Class);
Assert.IsNull(metapopulation.Find(inheritanceId));
Assert.IsNull(metapopulation.Find(relationTypeId));
Assert.IsNull(metapopulation.Find(associationTypeId));
Assert.IsNull(metapopulation.Find(roleTypeId));
Assert.IsNull(metapopulation.Find(superunitId));
Assert.IsNull(metapopulation.Find(superinterfaceId));
Assert.IsNull(metapopulation.Find(superclassId));
Assert.IsNull(metapopulation.Find(superinheritanceId));
Assert.IsNull(metapopulation.Find(superrelationTypeId));
Assert.IsNull(metapopulation.Find(superassociationTypeId));
Assert.IsNull(metapopulation.Find(superroleTypeId));
new InheritanceBuilder(domain, inheritanceId).WithSubtype(@class).WithSupertype(@interface).Build();
Assert.IsNotNull(metapopulation.Find(unitId) as Unit);
Assert.IsNotNull(metapopulation.Find(interfaceId) as Interface);
Assert.IsNotNull(metapopulation.Find(classId) as Class);
Assert.IsNotNull(metapopulation.Find(inheritanceId) as Inheritance);
//.........这里部分代码省略.........
示例5: Superdomains
public void Superdomains()
{
var metaPopulation = new MetaPopulation();
var anotherMetaPopulation = new MetaPopulation();
Assert.AreEqual(0, metaPopulation.Domains.Count());
var domain = new Domain(metaPopulation, Guid.NewGuid());
Assert.AreEqual(1, metaPopulation.Domains.Count());
var superdomain = new Domain(metaPopulation, Guid.NewGuid());
domain.AddDirectSuperdomain(superdomain);
Assert.AreEqual(2, metaPopulation.Domains.Count());
var anotherdomain = new Domain(anotherMetaPopulation, Guid.NewGuid());
Assert.AreEqual(2, metaPopulation.Domains.Count());
}
示例6: RelationTypes
public void RelationTypes()
{
var metaPopulation = new MetaPopulation();
var domain = new Domain(metaPopulation, Guid.NewGuid());
var superdomain = new Domain(metaPopulation, Guid.NewGuid());
domain.AddDirectSuperdomain(superdomain);
var c1 = new ClassBuilder(domain, Guid.NewGuid()).WithSingularName("c1").WithPluralName("c1s").Build();
var c2 = new ClassBuilder(superdomain, Guid.NewGuid()).WithSingularName("c2").WithPluralName("c2s").Build();
var i1 = new InterfaceBuilder(domain, Guid.NewGuid()).WithSingularName("i1").WithPluralName("i1s").Build();
var i2 = new InterfaceBuilder(superdomain, Guid.NewGuid()).WithSingularName("i2").WithPluralName("i2s").Build();
Assert.AreEqual(0, metaPopulation.RelationTypes.Count());
new RelationTypeBuilder(domain, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()).WithObjectTypes(c1, i1).Build();
Assert.AreEqual(1, metaPopulation.RelationTypes.Count());
new RelationTypeBuilder(superdomain, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()).WithObjectTypes(c1, i2).Build();
Assert.AreEqual(2, metaPopulation.RelationTypes.Count());
new RelationTypeBuilder(domain, Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()).WithObjectTypes(c1, c2).Build();
Assert.AreEqual(3, metaPopulation.RelationTypes.Count());
new MethodTypeBuilder(domain, Guid.NewGuid()).WithName("Method1").Build();
Assert.AreEqual(3, metaPopulation.RelationTypes.Count());
new MethodTypeBuilder(superdomain, Guid.NewGuid()).WithName("Method2").Build();
Assert.AreEqual(3, metaPopulation.RelationTypes.Count());
}
示例7: SuperDomains
public void SuperDomains()
{
var metaPopulation = new MetaPopulation();
var domain = new Domain(metaPopulation, Guid.NewGuid()) { Name = "Domain" };
Assert.AreEqual(0, domain.Superdomains.Count());
var superdomain = new Domain(metaPopulation, Guid.NewGuid()) { Name = "Superdomain" };
domain.AddDirectSuperdomain(superdomain);
Assert.AreEqual(1, domain.Superdomains.Count());
Assert.Contains(superdomain, domain.Superdomains.ToList());
Assert.AreEqual(0, superdomain.Superdomains.Count());
var supersuperdomain = new Domain(metaPopulation, Guid.NewGuid()) { Name = "Supersuperdomain" };
superdomain.AddDirectSuperdomain(supersuperdomain);
Assert.AreEqual(2, domain.Superdomains.Count());
Assert.Contains(superdomain, domain.Superdomains.ToList());
Assert.Contains(supersuperdomain, domain.Superdomains.ToList());
Assert.AreEqual(1, superdomain.Superdomains.Count());
Assert.Contains(supersuperdomain, superdomain.Superdomains.ToList());
Assert.AreEqual(0, supersuperdomain.Superdomains.Count());
}