public void Init()
		{
			originalXml = 
				"<root>\r\n" +
				"    <child>\r\n" +
				"    </child>\r\n" +
				"</root>";
			
			textEditor = new MockTextEditor();
			textEditor.OptionsConvertTabsToSpaces = true;
			textEditor.OptionsIndentationSize = 4;
			textEditor.OptionsIndentationString = " ";
			
			textEditor.Document.Text = originalXml;
					
			// Insert new xml as child element of <child>.
			// Insert position is just before the start of </root> end element.
			WixDocumentEditor editor = new WixDocumentEditor(textEditor);
			
			string xmlToInsert = 
				"<new-child>\r\n" +
				"</new-child>\r\n";
			
			int line = 3;
			int column = 5;
			editor.InsertIndented(line, column, xmlToInsert);
			
			document = textEditor.Document;
		}
		public void Init()
		{
			SD.InitializeForUnitTests();
			textEditor = new MockTextEditor();
			MockTextEditorViewContent viewContent = new MockTextEditorViewContent();
			viewContent.TextEditor = textEditor;
			viewContent.SetFileName(@"d:\projects\test\file.wxs");
			
			workbench = new MockWorkbench();
			workbench.ViewContentCollection.Add(viewContent);
			
			MockTextEditorOptions textEditorOptions = new MockTextEditorOptions();
			MockXmlTextWriter xmlTextWriter = new MockXmlTextWriter(textEditorOptions);
			WixProject project = WixBindingTestsHelper.CreateEmptyWixProject();
			document = new WixDocument(project, new DefaultFileLoader());
			document.LoadXml(GetWixXml());
			document.FileName = @"d:\projects\test\File.wxs";
			textEditor.Document.Text = GetWixXml();
			
			MockWixPackageFilesControl packageFilesControl = new MockWixPackageFilesControl();
			packageFilesView = new PackageFilesView(project, workbench, packageFilesControl, xmlTextWriter);
			
			packageFilesControl.IsDirty = true;
			AddNewChildElementsToDirectory();
			packageFilesView.Write(document);
		}
		public void Init()
		{
			textEditor = new MockTextEditor();
			textEditor.Document.Text = GetWixXml();
			
			string replacementXml = 
				"<NewElement>\r\n" +
				"</NewElement>";
			
			wixDocumentEditor = new WixDocumentEditor(textEditor);
			replacementRegion = wixDocumentEditor.ReplaceElement("TARGETDIR", "Directory", replacementXml);
		}
		protected override void AfterInit()
		{
			document.LoadXml(GetWixXml());
			
			textEditor = new MockTextEditor();
			textEditor.Document.Text = GetWixXml();
			viewWithOpenWixDocument.TextEditor = textEditor;
			
			AddNewChildElementsToDirectory();
			packageFilesControl.IsDirty = true;
			
			// User switches to text editor with WiX document that we are currently showing
			// in the PackageFilesView.
			workbench.ActiveViewContent = viewWithOpenWixDocument;
			workbench.RaiseActiveViewContentChangedEvent();
		}
		public void Init()
		{
			existingTextEditor = new MockTextEditor();
			MockTextEditorViewContent viewContent = new MockTextEditorViewContent();
			viewContent.TextEditor = existingTextEditor;
			viewContent.SetFileName(@"d:\projects\test\file.wxs");
			
			workbench = new MockWorkbench();
			workbench.ViewContentCollection.Add(new MockViewContent());
			workbench.ViewContentCollection.Add(viewContent);
			
			document = new WixDocument();
			document.FileName = @"d:\Projects\Test\File.wxs";
			
			openEditors = new OpenTextEditors(workbench);
		}
		public void Init()
		{
			originalXml = 
				"<root>\r\n" +
				"\t<child>\r\n" +
				"\t</child>\r\n" +
				"</root>";
			
			textEditor = new MockTextEditor();
			textEditor.OptionsConvertTabsToSpaces = false;
			textEditor.OptionsIndentationSize = 4;
			textEditor.OptionsIndentationString = "\t";
			
			document = textEditor.Document;

			textEditor.Document.Text = originalXml;
					
			// Replace the <child> element
			WixDocumentEditor editor = new WixDocumentEditor(textEditor);
			
			string xmlToInsert = 
				"<new-child>\r\n" +
				"</new-child>";
			
			int line = 2;
			int column = 2;
			int endLine = 3;
			
			// End column is the column containing the '>' of the </child> element.
			int endColumn = 9;
			
			DomRegion region = new DomRegion(line, column, endLine, endColumn);
			
			WixDocumentLineSegment lineSegment = WixDocumentLineSegment.ConvertRegionToSegment(textEditor.Document, region);
			initialDocumentRegionText = textEditor.Document.GetText(lineSegment.Offset, lineSegment.Length);

			editor.Replace(region, xmlToInsert);			
		}
		public void Init()
		{
			textEditor = new MockTextEditor();
		}
		public void TextEditorSetCanBeRetrieved()
		{
			MockTextEditor editor = new MockTextEditor();
			view.TextEditor = editor;
			Assert.AreSame(editor, view.TextEditor);
		}