public void BuildVirtualPath_1 () { MetaModel m = Utils.CommonInitialize (); MetaTable t = m.Tables[TestDataContext.TableBaz]; MetaColumn mc = t.GetColumn ("CustomUIHintColumn"); var ftf = new FieldTemplateFactory (); // It seems MetaColumn.UIHint is ignored (or rather it suggests that column is not used at all) Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Test.ascx", ftf.BuildVirtualPath ("Test", mc, DataBoundControlMode.ReadOnly), "#A1"); }
public void BuildVirtualPath () { MetaModel m = Utils.CommonInitialize (); MetaTable t = m.Tables[TestDataContext.TableBaz]; MetaColumn mc = t.GetColumn ("Column1"); var ftf = new FieldTemplateFactory (); AssertExtensions.Throws<ArgumentNullException> (() => { ftf.BuildVirtualPath (null, mc, DataBoundControlMode.ReadOnly); }, "#A1"); AssertExtensions.Throws<ArgumentNullException> (() => { ftf.BuildVirtualPath (String.Empty, mc, DataBoundControlMode.ReadOnly); }, "#A2"); Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Integer.ascx.ascx", ftf.BuildVirtualPath ("Integer.ascx", mc, DataBoundControlMode.ReadOnly), "#B1"); Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Integer.ascx", ftf.BuildVirtualPath ("Integer", mc, DataBoundControlMode.ReadOnly), "#B2"); Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Integer_Edit.ascx", ftf.BuildVirtualPath ("Integer", mc, DataBoundControlMode.Edit), "#B3"); Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Integer_Insert.ascx", ftf.BuildVirtualPath ("Integer", mc, DataBoundControlMode.Insert), "#B4"); Assert.AreEqual (ftf.TemplateFolderVirtualPath + "NoSuchTemplate.ascx", ftf.BuildVirtualPath ("NoSuchTemplate", mc, DataBoundControlMode.ReadOnly), "#B5"); Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Integer.ascx", ftf.BuildVirtualPath ("Integer", null, DataBoundControlMode.ReadOnly), "#B6"); Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Integer.ascx", ftf.BuildVirtualPath ("Integer", mc, (DataBoundControlMode)10), "#B7"); }