void Dissolve() { if (this.ownClass == null) { string ownClassName; string otherClassName; // Left class ownClassName = ri.ToString() + "Left"; if (ri.OwnPoly) { ownClassName += "Base"; } otherClassName = ri.ToString() + "Right"; if (ri.OtherPoly) { otherClassName += "Base"; } ownClass = new PersistentClass(ri.OwnPoly && ri.IsAbstract, this.nameSpace, ownClassName, null); if (ri.UseGuid) { ownClass.Attributes.Add("NDOOidType(typeof(Guid))"); } if (ri.OwnPoly) { string ownDerivedName = ri.ToString() + "LeftDerived"; ownDerivedClass = new PersistentClass(false, this.nameSpace, ownDerivedName, ownClass); if (ri.UseGuid) { ownDerivedClass.Attributes.Add("NDOOidType(typeof(Guid))"); } } // Right class otherClass = new PersistentClass(ri.OtherPoly && ri.IsAbstract, this.nameSpace, otherClassName, null); if (ri.UseGuid) { otherClass.Attributes.Add("NDOOidType(typeof(Guid))"); } if (ri.OtherPoly) { string otherDerivedName = ri.ToString() + "RightDerived"; otherDerivedClass = new PersistentClass(false, this.nameSpace, otherDerivedName, otherClass); if (ri.UseGuid) { otherDerivedClass.Attributes.Add("NDOOidType(typeof(Guid))"); } } } }
void GenerateTestGroup(RelInfo ri) { fixture = new TestFixture(this.nameSpace, "Test" + ri.ToString()); test = new Test(ri, "RelationTestClasses"); Class ownClass = null; Class otherClass = null; if (ri.OwnPoly) { ownClass = test.OwnDerivedClass; } else { ownClass = test.OwnClass; } if (ri.OtherPoly) { otherClass = test.OtherDerivedClass; } else { otherClass = test.OtherClass; } fixture.Statements.Add(test.OwnClass.Name + " ownVar;"); fixture.Statements.Add(test.OtherClass.Name + " otherVar;"); // always use the base class type fixture.Statements.Add("PersistenceManager pm;"); fixture.SetUp.Statements.Add("pm = PmFactory.NewPersistenceManager();"); fixture.SetUp.Statements.Add("ownVar = new " + ownClass.Name + "();"); fixture.SetUp.Statements.Add("otherVar = new " + otherClass.Name + "();"); GenerateTearDown(ri); CreateTests(ri); this.sw.WriteLine(fixture.ToString()); }
void GenerateTestGroup(RelInfo ri) { fixture = new TestFixture(this.nameSpace, "MappingTest" + ri.ToString()); test = new Test(ri, "RelationTestClasses"); fixture.AddField("PersistenceManager", "pm"); fixture.AddField("NDOMapping", "mapping"); fixture.AddField("Class", "ownClass"); fixture.AddField("Class", "otherClass"); if (ri.OwnPoly) { fixture.AddField("Class", "ownDerivedClass"); } if (ri.OtherPoly) { fixture.AddField("Class", "otherDerivedClass"); } fixture.SetUp.Statements.Add("this.pm = PmFactory.NewPersistenceManager();"); fixture.SetUp.Statements.Add("this.mapping = pm.NDOMapping;"); fixture.SetUp.Statements.Add($"this.ownClass = this.mapping.FindClass( \"{test.OwnClass.FullName}\" );"); fixture.SetUp.Statements.Add($"this.otherClass = this.mapping.FindClass( \"{test.OtherClass.FullName}\" );"); if (ri.OwnPoly) { fixture.SetUp.Statements.Add($"this.ownDerivedClass = this.mapping.FindClass( \"{test.OwnDerivedClass.FullName}\" );"); } if (ri.OtherPoly) { fixture.SetUp.Statements.Add($"this.otherDerivedClass = this.mapping.FindClass( \"{test.OtherDerivedClass.FullName}\" );"); } //GenerateTearDown( ri ); CreateTests(ri); this.sw.WriteLine(fixture.ToString()); }