public void AssignedFacetPropertyNode_provides_Item_without_value() { // ARRANGE var e = DefaultEntity(WithAssignedDefaultTag); // ACT var result = new AssignedFacetPropertyNode(this.PersistenceMock.Object, e, e.Tags.Single().Facet.Properties.Single()).GetItem(this.ProviderContextMock.Object); // ASSERT Assert.Equal("p", result.Property <string>("Name")); Assert.Equal(TreeStoreItemType.AssignedFacetProperty, result.Property <TreeStoreItemType>("ItemType")); Assert.Null(result.Property <string>("Value")); Assert.False(result.Property <bool>("HasValue")); Assert.Equal(FacetPropertyTypeValues.String, result.Property <FacetPropertyTypeValues>("ValueType")); Assert.IsType <AssignedFacetPropertyNode.Item>(result.ImmediateBaseObject); var resultValue = (AssignedFacetPropertyNode.Item)result.ImmediateBaseObject; Assert.Equal(TreeStoreItemType.AssignedFacetProperty, resultValue.ItemType); Assert.Equal("p", resultValue.Name); Assert.Null(resultValue.Value); Assert.False(resultValue.HasValue); Assert.Equal(e.Tags.Single().Facet.Properties.Single().Type, resultValue.ValueType); }
public void AssignedFacetPropertyNode_has_name_and_ItemMode() { // ARRANGE var e = DefaultEntity(WithAssignedDefaultTag); // ACT var result = new AssignedFacetPropertyNode(this.PersistenceMock.Object, e, e.Tags.Single().Facet.Properties.Single()); // ASSERT Assert.Equal("p", result.Name); }
public void AssignedFacetPropertyNode_provides_Value() { // ARRANGE var e = DefaultEntity(WithAssignedDefaultTag); // ACT var result = new AssignedFacetPropertyNode(this.PersistenceMock.Object, e, e.Tags.Single().Facet.Properties.Single()); // ASSERT Assert.Equal("p", result.Name); Assert.False(result.IsContainer); }
public void AssignedFacetPropertyNode_retrieves_specified_properties_with_value(string propertyName) { // ARRANGE var e = DefaultEntity(WithAssignedDefaultTag); e.SetFacetProperty(e.Tags.Single().Facet.Properties.Single(), "2"); // ACT var result = new AssignedFacetPropertyNode(this.PersistenceMock.Object, e, e.Tags.Single().Facet.Properties.Single()) .GetItemProperties(this.ProviderContextMock.Object, propertyName.Yield()); // ASSERT // value propert is returned Assert.Equal("Value", result.Single().Name); Assert.Equal("2", result.Single().Value); }
public void AssignedFacetPropertyNode_retrieves_properties_with_value() { // ARRANGE var e = DefaultEntity(WithAssignedDefaultTag); e.SetFacetProperty(e.Tags.Single().Facet.Properties.Single(), "2"); // ACT var result = new AssignedFacetPropertyNode(this.PersistenceMock.Object, e, e.Tags.Single().Facet.Properties.Single()) .GetItemProperties(this.ProviderContextMock.Object, Enumerable.Empty <string>()); // ASSERT // name and value are returned Assert.Equal(new[] { "Name", "HasValue", "Value", "ValueType", "ItemType" }, result.Select(p => p.Name)); Assert.Equal(new object[] { "p", true, "2", FacetPropertyTypeValues.String, TreeStoreItemType.AssignedFacetProperty }, result.Select(p => p.Value)); }