public static void Test2() { IMigrationContextHolderService holder = CreateContextHolder(); MigrationContext context = holder.Context; DataPathTranslationService dataPathTranslator = new DataPathTranslationService(); dataPathTranslator.ContextHolder = holder; dataPathTranslator.RegisterField(DataPath.Parse("CONTACT:ACCID>ACCOUNTID.ACCOUNT!ACCOUNT")); dataPathTranslator.RegisterField(DataPath.Parse("CONTACT:ACCID>ACCOUNTID.ACCOUNT!TYPE")); dataPathTranslator.RegisterField(DataPath.Parse("CONTACT:ACCID>ACCOUNTID.ACCOUNT!STATUS")); Debug.Assert(context.Tables.Count == 2); Debug.Assert(context.Tables.ContainsKey("CONTACT")); Debug.Assert(context.Tables.ContainsKey("ACCOUNT")); TableInfo contact = context.Tables["CONTACT"]; TableInfo account = context.Tables["ACCOUNT"]; Debug.Assert(contact.Joins.Count == 1); DataPathJoin j = new DataPathJoin("CONTACT", "ACCID", "ACCOUNTID", "ACCOUNT"); Debug.Assert(contact.Joins.ContainsKey(j)); Debug.Assert(contact.Joins[j] == account); Debug.Assert(contact.Columns.Count == 1); Debug.Assert(contact.Columns.Contains("ACCID")); Debug.Assert(account.Joins.Count == 0); Debug.Assert(account.Columns.Count == 4); Debug.Assert(account.Columns.ContainsAll(new string[] {"ACCOUNTID", "ACCOUNT", "TYPE", "STATUS"})); }
public static void Test1() { IMigrationContextHolderService holder = CreateContextHolder(); MigrationContext context = holder.Context; DataPathTranslationService dataPathTranslator = new DataPathTranslationService(); dataPathTranslator.ContextHolder = holder; dataPathTranslator.RegisterField(DataPath.Parse("ACCOUNT:ACCOUNT")); dataPathTranslator.RegisterField(DataPath.Parse("ACCOUNT:TYPE")); dataPathTranslator.RegisterField(DataPath.Parse("ACCOUNT:STATUS")); Debug.Assert(context.Tables.Count == 1); Debug.Assert(context.Tables.ContainsKey("ACCOUNT")); TableInfo t = context.Tables["ACCOUNT"]; Debug.Assert(t.Joins.Count == 0); Debug.Assert(t.Columns.Count == 3); Debug.Assert(t.Columns.ContainsAll(new string[] {"ACCOUNT", "TYPE", "STATUS"})); }