public void CanUpdateEditorInSecuredContainerWhenUserIsTrusted() { var item = new ItemWithSecuredContainer {HiddenText = "Yes way"}; var user = CreatePrincipal("Joe", "Administrators"); var editorContainer = new Control(); var added = editManager.AddEditors(definitions.GetDefinition(typeof(ItemWithSecuredContainer)), item, editorContainer, user); editManager.UpdateEditors(definitions.GetDefinition(item.GetContentType()), item, added, user); Assert.That(((TextBox)added["HiddenText"]).Text, Is.EqualTo("Yes way")); }
public void WillNotAddOrUpdateEditorInSecuredContainerWhenUntrustedUser() { var item = new ItemWithSecuredContainer {HiddenText = "No way"}; var user = CreatePrincipal("Joe", "Editor"); var editorContainer = new Control(); var added = editManager.AddEditors(definitions.GetDefinition(typeof(ItemWithSecuredContainer)), item, editorContainer, user); editManager.UpdateEditors(definitions.GetDefinition(item.GetContentType()), item, added, user); Assert.That(added.Count, Is.EqualTo(0)); }