Пример #1
0
        public void BuiltInProperties()
        {
            Federation federation = WikiTestUtilities.SetupFederation("test://ParsingProviderTests",
                new TestContentSet(new TestNamespace("NamespaceOne")));
            NamespaceManager manager = WikiTestUtilities.GetNamespaceManagerBypassingSecurity(federation, "NamespaceOne");

            string contents = @"Some content that tries to override one of the built-in properties
            _TopicName: NotTheTopicName";
            string author = "testauthor";
            string topicName = "TopicOne";
            QualifiedTopicName qualifiedTopicName = new QualifiedTopicName(topicName, manager.Namespace);

            manager.WriteTopicAndNewVersion("TopicOne", contents, author);
            ParsingProvider provider = (ParsingProvider)manager.GetProvider(typeof(ParsingProvider));

            ParsedTopic parsedTopic = provider.GetParsedTopic(new UnqualifiedTopicRevision("TopicOne"));

            TopicChange latestRevision = manager.AllChangesForTopic(topicName).Latest;

            AssertPropertyContents(parsedTopic, "_TopicName", qualifiedTopicName.LocalName);
            AssertPropertyContents(parsedTopic, "_TopicFullName", qualifiedTopicName.DottedName);
            AssertPropertyContents(parsedTopic, "_LastModifiedBy", author);
            AssertPropertyContents(parsedTopic, "_CreationTime", latestRevision.Created.ToString());
            AssertPropertyContents(parsedTopic, "_ModificationTime", latestRevision.Modified.ToString());
            AssertPropertyContents(parsedTopic, "_Body", contents);
        }
Пример #2
0
 public TopicDependency(QualifiedTopicName topicName)
 {
     _topicName = topicName;
 }
 public TopicContentsDependency(QualifiedTopicName topicName)
     : base(topicName)
 {
 }
 public TopicPermissionsDependency(QualifiedTopicName topicName)
     : base(topicName)
 {
 }
Пример #5
0
 private bool IsDefinitionTopic(UnqualifiedTopicRevision topicRevision)
 {
     QualifiedTopicName topicName = new QualifiedTopicName(topicRevision.LocalName, Namespace);
     return topicName.Equals(NamespaceManager.DefinitionTopicName);
 }
Пример #6
0
 private bool IsBuiltInTopic(UnqualifiedTopicName topic)
 {
     QualifiedTopicName qualifiedTopicName = new QualifiedTopicName(topic.LocalName, Namespace);
     return GetBuiltInTopics().Contains(qualifiedTopicName); 
 }
Пример #7
0
        private string DefaultContentFor(string topic)
        {
            QualifiedTopicName topicName = new QualifiedTopicName(topic, Namespace);

            if (topicName.Equals(NamespaceManager.HomePageTopicName))
            {
                return c_defaultHomePageContent; 
            }
            else if (topicName.Equals(NamespaceManager.BordersTopicName))
            {
                return c_defaultNormalBordersContent;
            }
            else
            {
                return null; 
            }
            
        }
Пример #8
0
 /// <summary>
 /// Rename the given topic.  If requested, find references and fix them up.  Answer a report of what was fixed up.  Throw a DuplicationTopicException
 /// if the new name is the name of a topic that already exists.
 /// </summary>
 /// <param name="oldName">Old topic name</param>
 /// <param name="newName">The new name</param>
 /// <param name="fixup">true to fixup referenced topic *in this namespace*; false to do no fixups</param>
 /// <returns>ArrayList of strings that can be reported back to the user of what happened during the fixup process</returns>
 public RenameTopicDetails RenameTopic(QualifiedTopicName oldName, UnqualifiedTopicName newName, ReferenceFixupPolicy fixupPolicy, string author)
 {
     NamespaceManager namespaceManager = NamespaceManagerForTopic(oldName);
     if (namespaceManager == null)
     {
         throw NamespaceNotFoundException.ForNamespace(oldName.Namespace);
     }
     return namespaceManager.RenameTopic(new UnqualifiedTopicName(oldName.LocalName), new UnqualifiedTopicName(newName.LocalName), fixupPolicy, author);
 }
 public TopicExistenceDependency(QualifiedTopicName topicName)
     : base(topicName)
 {
 }
Пример #10
0
 private bool IsBuiltInTopic(UnqualifiedTopicName topic)
 {
     // This is to prevent infinite recursion - we need to query the definition topic
     // to figure out the HomePage and the Borders topic.
     if (topic.LocalName == NamespaceManager.DefinitionTopicLocalName)
     {
         return false;
     }
     QualifiedTopicName qualifiedTopicName = new QualifiedTopicName(topic.LocalName, Namespace);
     return GetBuiltInTopics().Contains(qualifiedTopicName);
 }