Example #1
0
        public void AssignedTagNode_has_name_and_IsContainer()
        {
            // ARRANGE

            var e = DefaultEntity(WithAssignedDefaultTag);

            // ACT

            var result = new AssignedTagNode(e, e.Tags.Single());

            // ASSERT

            Assert.Equal("t", result.Name);
            Assert.False(result.IsContainer);
        }
Example #2
0
        public void AssignedTagNode_retrieves_specified_property_with_value(string propertyName)
        {
            // ARRANGE

            var e = DefaultEntity(WithAssignedDefaultTag);

            e.SetFacetProperty(e.Tags.Single().Facet.Properties.Single(), "1");

            // ACT

            var result = new AssignedTagNode(e, e.Tags.Single()).GetItemProperties(this.ProviderContextMock.Object, propertyNames: new[] { propertyName });

            // ASSERT

            Assert.Single(result);
        }
Example #3
0
        public void AssignedTagNode_retrieves_properties_with_values()
        {
            // ARRANGE

            var e = DefaultEntity(WithAssignedDefaultTag);

            e.SetFacetProperty(e.Tags.Single().Facet.Properties.Single(), "1");

            // ACT

            var result = new AssignedTagNode(e, e.Tags.Single()).GetItemProperties(this.ProviderContextMock.Object, propertyNames: Enumerable.Empty <string>());

            // ASSERT

            //todo: properties //Assert.Equal(new[] { "p", "Name", "ItemType", "Properties" }, result.Select(p => p.Name));
            Assert.Equal(new[] { "p", "Id", "Name", "ItemType" }, result.Select(p => p.Name));
            //todo: properties Assert.Equal(new object[] { "1", "t", TreeStoreItemType.AssignedTag, new string[] { "p" } }, result.Select(p => p.Value));
            Assert.Equal(new object[] { "1", e.Tags.Single().Id, "t", TreeStoreItemType.AssignedTag }, result.Select(p => p.Value));
        }
Example #4
0
        public void AssignedTagNode_provides_Item()
        {
            // ARRANGE

            var e = DefaultEntity(WithAssignedDefaultTag);

            e.SetFacetProperty(e.Tags.Single().Facet.Properties.Single(), "1");

            // ACT

            var result = new AssignedTagNode(e, e.Tags.Single()).GetItem(this.ProviderContextMock.Object);

            // ASSERT

            Assert.Equal(e.Tags.Single().Id, result.Property <Guid>("Id"));
            Assert.Equal("t", result.Property <string>("Name"));
            Assert.Equal(TreeStoreItemType.AssignedTag, result.Property <TreeStoreItemType>("ItemType"));
            Assert.Equal("1", result.Property <string>("p"));
            //todo: properties // Assert.Equal("p", result.Property<string[]>("Properties").Single());
            Assert.IsType <AssignedTagNode.Item>(result.ImmediateBaseObject);
        }