示例#1
0
    public void RestoreTopic()
    {
      TestNamespace testNamespace = testContent.Namespaces[1]; 
      TestTopic testTopic = testNamespace.Topics[2];
      EditService.AbsoluteTopicName topicName = new EditService.AbsoluteTopicName(); 
      topicName.Namespace = testNamespace.Name; 
      topicName.Name = testTopic.Name; 
      StringCollection versions = GetVersions(testNamespace.Name, testTopic.Name); 

      proxy.RestoreTopic(topicName, "BuildVerificationTests", versions[0]); 

      string text = proxy.GetTextForTopic(topicName); 

      Assert.AreEqual(testTopic.ContentHistory[0], text, "Checking that topic text was restored"); 
    }
示例#2
0
    public void SetTextForTopic()
    {
      TestNamespace testNamespace = testContent.Namespaces[1]; 
      TestTopic testTopic = testNamespace.Topics[2];
      string newContent = "This is the replacement text.";

      EditService.AbsoluteTopicName topicName = new EditService.AbsoluteTopicName(); 
      topicName.Namespace = testNamespace.Name; 
      topicName.Name = testTopic.Name; 

      proxy.SetTextForTopic(topicName, newContent, "BuildVerificationTests"); 

      string retrievedContent = proxy.GetTextForTopic(topicName); 

      Assert.AreEqual(newContent, retrievedContent, "Checking that topic text was updated on the remote wiki."); 

    }
示例#3
0
    public void GetVersionsForTopic()
    {
      TestNamespace testNamespace = testContent.Namespaces[1]; 
      TestTopic testTopic = testNamespace.Topics[2];
      EditService.AbsoluteTopicName topicName = new EditService.AbsoluteTopicName(); 
      topicName.Namespace = testNamespace.Name; 
      topicName.Name = testTopic.Name; 

      string[] versions = proxy.GetVersionsForTopic(topicName); 
      StringCollection expectedVersions = GetVersions(testNamespace.Name, testTopic.Name); 

      Assert.AreEqual(expectedVersions.Count, versions.Length, "Checking that right number of versions were returned"); 

      int n = expectedVersions.Count; 
      for (int i = 0; i < n; ++i)
      {
        // Versions are returned from the web service in reverse order
        Assert.AreEqual(expectedVersions[i], versions[n - i - 1], "Checking that correct version was returned"); 
      }

    }
示例#4
0
	public void GetTextForTopicVersion()
	{
		TestNamespace testNamespace = testContent.Namespaces[1]; 
		TestTopic testTopic = testNamespace.Topics[2];
		string oldVersion = GetVersions(testNamespace.Name, testTopic.Name)[0]; 

		EditService.AbsoluteTopicName topicName = new EditService.AbsoluteTopicName(); 
		topicName.Namespace = testNamespace.Name; 
		topicName.Name = testTopic.Name; 
		topicName.Version = oldVersion;
		string raw = proxy.GetTextForTopic(topicName); 

		Assert.IsFalse(raw.IndexOf("This is some old test content") == -1, 
			"Checking that old content was returned"); 
	}
示例#5
0
    public void GetTextForTopic()
    {
      TestNamespace testNamespace = testContent.Namespaces[1]; 
      TestTopic testTopic = testNamespace.Topics[2];
      EditService.AbsoluteTopicName topicName = new EditService.AbsoluteTopicName(); 
      topicName.Namespace = testNamespace.Name; 
      topicName.Name = testTopic.Name; 

      string text = proxy.GetTextForTopic(topicName); 

      Assert.AreEqual(testTopic.LatestContent, text, "Checking that correct text was returned"); 
    }
示例#6
0
    public void GetPreviewForTopic()
    {
      TestNamespace testNamespace = testContent.Namespaces[1]; 
      TestTopic testTopic = testNamespace.Topics[2];
      EditService.AbsoluteTopicName topicName = new EditService.AbsoluteTopicName(); 
      topicName.Namespace = testNamespace.Name; 
      topicName.Name = testTopic.Name; 

      string html = proxy.GetPreviewForTopic(topicName, "This is some unrelated text with a WikiWord in it."); 

      Assert.IsTrue(html.IndexOf("This is some unrelated text") != 0, 
        "Checking that plain text was rendered to HTML"); 
      Assert.IsTrue(Regex.IsMatch(html, @"\<a.*\>WikiWord.*\</a\>"), 
        "Checking that a link was rendered"); 

    } 
示例#7
0
    public void GetHtmlForTopic()
    {
      TestNamespace testNamespace = testContent.Namespaces[1]; 
      EditService.AbsoluteTopicName topicName = new EditService.AbsoluteTopicName(); 
      topicName.Namespace = testNamespace.Name; 
      topicName.Name = testNamespace.Topics[1].Name; 
      string html = proxy.GetHtmlForTopic(topicName); 

      Assert.IsFalse(html.IndexOf("This is yet more content") == -1, 
        "Checking that plain wiki text is rendered to HTML correctly"); 
      Assert.IsTrue(Regex.IsMatch(html, @"\<a.*\>NamespaceTwo.*\</a\>"), 
        "Checking that a link was rendered"); 
    }