Exemplo n.º 1
0
        public void TagNode_creates_FacetProperty(string itemTypeName)
        {
            // ARRANGE

            var tag = DefaultTag(WithoutProperty);

            this.ProviderContextMock
            .Setup(c => c.Persistence)
            .Returns(this.PersistenceMock.Object);

            this.ProviderContextMock
            .Setup(c => c.DynamicParameters)
            .Returns(new TagNode.NewFacetPropertyParameters
            {
                ValueType = FacetPropertyTypeValues.Bool
            });

            this.PersistenceMock
            .Setup(m => m.Tags)
            .Returns(this.TagRepositoryMock.Object);

            this.TagRepositoryMock
            .Setup(r => r.Upsert(tag))
            .Returns(tag);

            // ACT

            var result = new TagNode(tag)
                         .NewItem(this.ProviderContextMock.Object, newItemChildPath: "p", itemTypeName: itemTypeName, newItemValue: null);

            // ASSERT

            Assert.IsType <FacetPropertyNode>(result);
            Assert.Equal("p", result !.Name);
            Assert.Equal(FacetPropertyTypeValues.Bool, ((FacetPropertyNode.Item)result.GetItem(this.ProviderContextMock.Object).ImmediateBaseObject).ValueType);
        }