本文整理汇总了C#中N2.Tests.Edit.Items.ComplexContainersItem.GetContentType方法的典型用法代码示例。如果您正苦于以下问题:C# ComplexContainersItem.GetContentType方法的具体用法?C# ComplexContainersItem.GetContentType怎么用?C# ComplexContainersItem.GetContentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类N2.Tests.Edit.Items.ComplexContainersItem
的用法示例。
在下文中一共展示了ComplexContainersItem.GetContentType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanUpdateEditors
public void CanUpdateEditors()
{
ComplexContainersItem item = new ComplexContainersItem();
IDictionary<string, Control> added = AddEditors(item);
TextBox tbp0 = added["MyProperty0"] as TextBox;
TextBox tbp1 = added["MyProperty1"] as TextBox;
TextBox tbp2 = added["MyProperty2"] as TextBox;
FreeTextArea ftap3 = added["MyProperty3"] as FreeTextArea;
CheckBox cbp4 = added["MyProperty4"] as CheckBox;
Assert.IsEmpty(tbp0.Text);
Assert.IsEmpty(tbp1.Text);
Assert.IsEmpty(tbp2.Text);
Assert.IsEmpty(ftap3.Text);
Assert.IsFalse(cbp4.Checked);
item.MyProperty0 = "one";
item.MyProperty1 = "two";
item.MyProperty2 = "three";
item.MyProperty3 = "rock";
item.MyProperty4 = true;
editManager.UpdateEditors(definitions.GetDefinition(item.GetContentType()), item, added, CreatePrincipal("someone"));
Assert.AreEqual("one", tbp0.Text);
Assert.AreEqual("two", tbp1.Text);
Assert.AreEqual("three", tbp2.Text);
Assert.AreEqual("rock", ftap3.Text);
Assert.IsTrue(cbp4.Checked);
}
示例2: AddEditors
protected IDictionary<string, Control> AddEditors(ComplexContainersItem item)
{
Type itemType = item.GetContentType();
Control editorContainer = new Control();
IDictionary<string, Control> added = editManager.AddEditors(definitions.GetDefinition(itemType), item, editorContainer, CreatePrincipal("someone"));
return added;
}
示例3: UpdateItem_WithNoChanges_ReturnsFalse
public void UpdateItem_WithNoChanges_ReturnsFalse()
{
ComplexContainersItem item = new ComplexContainersItem();
Type itemType = item.GetContentType();
Control editorContainer = new Control();
IDictionary<string, Control> added = editManager.AddEditors(definitions.GetDefinition(itemType), item, editorContainer, CreatePrincipal("someone"));
item.MyProperty0 = "one";
item.MyProperty1 = "two";
item.MyProperty2 = "three";
item.MyProperty3 = "rock";
item.MyProperty4 = true;
editManager.UpdateEditors(definitions.GetDefinition(item.GetContentType()), item, added, CreatePrincipal("someone"));
var result = editManager.UpdateItem(definitions.GetDefinition(item.GetContentType()), item, added, null);
Assert.IsFalse(result.Length > 0, "UpdateItem didn't return false even though the editors were unchanged.");
}
示例4: UpdateItem_WithChanges_ReturnsTrue
public void UpdateItem_WithChanges_ReturnsTrue()
{
ComplexContainersItem item = new ComplexContainersItem();
IDictionary<string, Control> added = AddEditors(item);
TextBox tbp0 = added["MyProperty0"] as TextBox;
TextBox tbp1 = added["MyProperty1"] as TextBox;
TextBox tbp2 = added["MyProperty2"] as TextBox;
FreeTextArea ftap3 = added["MyProperty3"] as FreeTextArea;
CheckBox cbp4 = added["MyProperty4"] as CheckBox;
tbp0.Text = "one";
tbp1.Text = "two";
tbp2.Text = "three";
ftap3.Text = "rock";
cbp4.Checked = true;
var result = editManager.UpdateItem(definitions.GetDefinition(item.GetContentType()), item, added, CreatePrincipal("someone"));
Assert.That(result.Length, Is.GreaterThan(0), "UpdateItem didn't return true even though the editors were changed.");
}
示例5: CanUpdateItem
public void CanUpdateItem()
{
ComplexContainersItem item = new ComplexContainersItem();
IDictionary<string, Control> added = AddEditors(item);
var tbp0 = added["MyProperty0"] as TextBox;
var tbp1 = added["MyProperty1"] as TextBox;
var tbp2 = added["MyProperty2"] as TextBox;
var ftap3 = added["MyProperty3"] as FreeTextArea;
var cbp4 = added["MyProperty4"] as CheckBox;
Assert.That(tbp0 != null);
Assert.That(tbp1 != null);
Assert.That(tbp2 != null);
Assert.That(ftap3 != null);
Assert.That(cbp4 != null);
Assert.IsEmpty(item.MyProperty0);
Assert.IsEmpty(item.MyProperty1);
Assert.IsEmpty(item.MyProperty2);
Assert.IsEmpty(item.MyProperty3);
Assert.IsFalse(item.MyProperty4);
tbp0.Text = "one";
tbp1.Text = "two";
tbp2.Text = "three";
ftap3.Text = "rock";
cbp4.Checked = true;
editManager.UpdateItem(definitions.GetDefinition(item.GetContentType()), item, added, CreatePrincipal("someone"));
Assert.AreEqual("one", item.MyProperty0);
Assert.AreEqual("two", item.MyProperty1);
Assert.AreEqual("three", item.MyProperty2);
Assert.AreEqual("rock", item.MyProperty3);
Assert.IsTrue(item.MyProperty4);
}
示例6: UpdateItemWithChangesReturnsTrue
public void UpdateItemWithChangesReturnsTrue()
{
var item = new ComplexContainersItem();
var added = AddEditors(item);
var tbp0 = added["MyProperty0"] as TextBox;
var tbp1 = added["MyProperty1"] as TextBox;
var tbp2 = added["MyProperty2"] as TextBox;
var ftap3 = added["MyProperty3"] as FreeTextArea;
var cbp4 = added["MyProperty4"] as CheckBox;
Assert.That(tbp0 != null, "tbp0 != null");
Assert.That(tbp1 != null, "tbp1 != null");
Assert.That(tbp2 != null, "tbp2 != null");
Assert.That(ftap3 != null, "ftap3 != null");
Assert.That(cbp4 != null, "cbp4 != null");
tbp0.Text = "one";
tbp1.Text = "two";
tbp2.Text = "three";
ftap3.Text = "rock";
cbp4.Checked = true;
var result = editManager.UpdateItem(definitions.GetDefinition(item.GetContentType()), item, added, CreatePrincipal("someone"));
Assert.That(result.Length, Is.GreaterThan(0), "UpdateItem didn't return true even though the editors were changed.");
}
示例7: AddEditors
protected IDictionary<string, Control> AddEditors(ComplexContainersItem item)
{
Type itemType = item.GetContentType();
Control editorContainer = new Control();
IDictionary<string, Control> added = editManager.AddEditors(itemType, editorContainer, null);
return added;
}