public void GenerateForDocumentTypeIdAlias()
        {
            var titleDt = new UmbracoPropertyType { DatabaseType = "nvarchar", Name = "title" };
            var contentDt = new UmbracoPropertyType { DatabaseType = "nvarchar", Name = "content" };

            var mockPropTypeRepo = new Mock<IUmbracoPropertyTypeRepository>();
            mockPropTypeRepo.Setup(x => x.GetForNativeDocumentTypePropertyAlias(9, "title"))
                .Returns(titleDt);
            mockPropTypeRepo.Setup(x => x.GetForNativeDocumentTypePropertyAlias(9, "content"))
                .Returns(contentDt);

            var factory = new PropertyTypeFactory(mockPropTypeRepo.Object);

            var prop1 = factory.GenerateForDocumentTypeIdAlias(9, "title");
            Assert.AreEqual("http://localhost/rdf/ontology#hasTitle", prop1.Iri);
            Assert.AreEqual("nvarchar", prop1.DatabaseType);

            var prop2 = factory.GenerateForDocumentTypeIdAlias(9, "content");
            Assert.AreEqual("http://localhost/rdf/ontology#hasContent", prop2.Iri);
            Assert.AreEqual("nvarchar", prop2.DatabaseType);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OntologyFactory"/> class.
 /// </summary>
 /// <param name="documentTypeRepository">The umbraco document type repository.</param>
 /// <param name="propertyTypeRepository">The umbraco property type repository.</param>
 /// <remarks></remarks>
 public OntologyFactory(IUmbracoDocumentTypeRepository documentTypeRepository,
     IUmbracoPropertyTypeRepository propertyTypeRepository)
 {
     _documentTypeRepository = documentTypeRepository;
     _propertyTypeFactory = new PropertyTypeFactory(propertyTypeRepository);
 }