changeset 123:1d7e370a91fa

Additional DOM::Node tests
author wizard
date Wed, 09 Jun 2010 17:53:12 +0400
parents a7efb3117295
children e30bdd040fe3
files _test/Test/DOM/Node.pm
diffstat 1 files changed, 40 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/_test/Test/DOM/Node.pm	Tue Jun 08 20:12:45 2010 +0400
+++ b/_test/Test/DOM/Node.pm	Wed Jun 09 17:53:12 2010 +0400
@@ -121,11 +121,50 @@
     failed "property isComplex returned true for a simple node", $this->Root->firstChild->nodeName if $this->Root->firstChild->isComplex;
 };
 
+test setObjectProperty => sub {
+	my ($this) = @_;
+	
+	my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
+	
+	my $name = 'Vergon 6';
+	
+	$node->nodeProperty(name => $name);
+	failed "Failed to set a property 'name'", "Expected: $name", "Got: ".$node->name unless $node->name eq $name;
+	
+	$name = 'entity_vergon_6';
+	$node->systemName($name);
+	failed "Failed to set a property 'systemName'", "Expected: $name", "Got: ".$node->nodeProperty('systemName') unless $node->nodeProperty('systemName') eq $name;
+};
+
+test setDynamicProperty => sub {
+	my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
+	
+	my $uuid = 'entity_76fd98b9e7a';
+	$node->nodeProperty(uuid => $uuid);
+	failed "Failed to set a dynamic property 'uuid'", "Expected: $uuid", "Got: ".$node->nodeProperty('uuid') unless $node->nodeProperty('uuid') eq $uuid;
+};
+
+test setPrivateProperty => sub {
+	my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
+	
+	eval {
+		$node->nodeProperty(_private => 'failed');
+		1;
+	} and failed "Setting a private property successfull";
+};
+
 package Test::DOM::TypedNode;
 use base qw(IMPL::DOM::Node);
 use IMPL::Class::Property;
-use IMPL::DOM::Property;
+use IMPL::DOM::Property qw(_dom);
+
+__PACKAGE__->PassThroughArgs;
 
+BEGIN {
+	public _dom property name => prop_all;
+	public property systemName => prop_all;
+	private _dom property _private => prop_all;   
+}
 
 
 1;