コード例 #1
0
		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"));
		}
コード例 #2
0
		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));
		}