/// <summary> /// Helper method to get a work item from word /// </summary> /// <param name="ids"></param> /// <param name="serverConfiguration"></param> /// <returns></returns> private IEnumerable <IWorkItem> GetWordWorkItems(int[] ids, ServerConfiguration serverConfiguration) { var configuration = serverConfiguration.Configuration; var wordAdapter = new Word2007TableSyncAdapter(_document, configuration); wordAdapter.Open(ids); return(wordAdapter.WorkItems); }
public void WordTableWorkItem_AddLinks_ShouldReplaceLinksIfOverwriteIsFalse() { var target = new WordTableWorkItem(_testDocument.Tables[1], "Requirement", CommonConfiguration.Configuration, CommonConfiguration.Configuration.GetWorkItemConfiguration("Requirement")); var fakeAdapter = new Word2007TableSyncAdapter(_testDocument, CommonConfiguration.Configuration); fakeAdapter.Open(null); target.AddLinks(fakeAdapter, new[] { 4, 5 }, "Child", false); Assert.IsTrue(_testDocument.Tables[1].Cell(2, 2).Range.Text.StartsWith("4,5", StringComparison.OrdinalIgnoreCase)); }
public void WordTableWorkItem_AddBookmarks_DocumentAndRequirementShouldContainBookmark() { var target = new WordTableWorkItem(_testDocument.Tables[1], "Requirement", CommonConfiguration.Configuration, CommonConfiguration.Configuration.GetWorkItemConfiguration("Requirement")); var fakeAdapter = new Word2007TableSyncAdapter(_testDocument, CommonConfiguration.Configuration); fakeAdapter.Open(null); Assert.IsNotNull(target); //Desription should contain a Bookmark Assert.AreEqual(_testDocument.Tables[1].Cell(3, 1).Range.Bookmarks.Count, 1); Assert.AreEqual(_testDocument.Tables[1].Cell(3, 1).Range.Bookmarks[1].Name, CommonConfiguration.BookmarkName); //Title should not contain a Bookmark Assert.AreNotEqual(_testDocument.Tables[1].Cell(2, 1).Range.Bookmarks.Count, 1); //The First Bookmark in the document should be the one from the configuration Assert.AreEqual(_testDocument.Bookmarks[1].Name, CommonConfiguration.BookmarkName); //The Value of the the Bookmarkshould be the value of the Description Assert.IsTrue(_testDocument.Tables[1].Cell(3, 1).Range.Text.Contains(_testDocument.Bookmarks[1].Range.Text)); }