public void TestSimplePaste()
		{
			SourceText sourceText;
			var indent = CreateEngine(@"
class Foo
{
	void Bar ()
	{
		System.Console.WriteLine ($);
	}
}", out sourceText);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, FormattingOptionsFactory.CreateMono());
			var text = handler.FormatPlainText(sourceText, indent.Offset, "Foo", null);
			Assert.AreEqual("Foo", text);
		}
		public void TestMultiLinePaste()
		{
			SourceText sourceText;
			var indent = CreateEngine(@"
namespace FooBar
{
	class Foo
	{
		void Bar ()
		{
			System.Console.WriteLine ();
		}
		$
	}
}
", out sourceText);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, FormattingOptionsFactory.CreateMono());
			
			var text = handler.FormatPlainText(sourceText, indent.Offset, "void Bar ()\n{\nSystem.Console.WriteLine ();\n}", null);
			Assert.AreEqual("void Bar ()\n\t\t{\n\t\t\tSystem.Console.WriteLine ();\n\t\t}", text);
		}
		public void TestBug16415 ()
		{
			SourceText sourceText;
			var opt = FormattingOptionsFactory.CreateMono();
			var indent = CreateEngine("class Foo\n{\n\tpublic static void Main (string[] args)\n\t{\n\t\tConsole.WriteLine ();$\n\t}\n}\n", out sourceText, opt);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, opt);
			var text = handler.FormatPlainText(sourceText, indent.Offset, "// Line 1\n// Line 2\n// Line 3", null);
			Assert.AreEqual("// Line 1\n\t\t// Line 2\n\t\t// Line 3", text);
		}
		public void PastePreProcessorDirectivesNoIndent()
		{
			var opt = FormattingOptionsFactory.CreateMono();
//			opt.IndentPreprocessorDirectives = false;

			SourceText sourceText;
			var indent = CreateEngine(@"
class Foo
{
$
}", out sourceText, opt);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, opt);
			var text = handler.FormatPlainText(sourceText, indent.Offset, "#if DEBUG\n\tvoid Foo()\n\t{\n\t}\n#endif", null);
			Assert.AreEqual("#if DEBUG\n\tvoid Foo()\n\t{\n\t}\n#endif", text);
		}
		public void PasteInTerminatedVerbatimString ()
		{
			var opt = FormattingOptionsFactory.CreateMono();
			//opt.IndentPreprocessorDirectives = false;

			SourceText sourceText;
			var indent = CreateEngine(@"
var foo = @""hello$"";
", out sourceText,opt);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, opt);
			var text = handler.FormatPlainText(sourceText, indent.Offset, "Hi \" + username;", null);
			Assert.AreEqual("Hi \"\" + username;", text);
		}
		public void PastemultilineAtFirstColumnCorrection()
		{
			SourceText sourceText;
			var indent = CreateEngine("class Foo\n{\n$\n}", out sourceText);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, FormattingOptionsFactory.CreateMono());
			var text = handler.FormatPlainText(sourceText, indent.Offset, "void Bar ()\n{\n\tSystem.Console.WriteLine ();\n}", null);
			Assert.AreEqual("\tvoid Bar ()\n\t{\n\t\tSystem.Console.WriteLine ();\n\t}", text);
		}
		public void TestPasteToWindowsEol()
		{
			SourceText sourceText;
			var indent = CreateEngine("$", out sourceText);
			var options = FormattingOptionsFactory.CreateMono();
			options = options.WithChangedOption(FormattingOptions.NewLine, LanguageNames.CSharp, "\r\n");
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, options);
			var text = handler.FormatPlainText(sourceText, indent.Offset, "namespace Foo\n{\n\tpublic static class FooExtensions\n\t{\n\t\tpublic static int ObjectExtension (this object value)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\n\t\tpublic static int IntExtension (this int value)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tpublic class Client\n\t{\n\t\tpublic void Method ()\n\t\t{\n\t\t\t0.ToString ();\n\t\t}\n\t}\n}", null);
			Assert.AreEqual("namespace Foo\r\n{\r\n\tpublic static class FooExtensions\r\n\t{\r\n\t\tpublic static int ObjectExtension (this object value)\r\n\t\t{\r\n\t\t\treturn 0;\r\n\t\t}\r\n\r\n\t\tpublic static int IntExtension (this int value)\r\n\t\t{\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic class Client\r\n\t{\r\n\t\tpublic void Method ()\r\n\t\t{\r\n\t\t\t0.ToString ();\r\n\t\t}\r\n\t}\r\n}", text);
		}
		public void PasteVerbatimStringBug4()
		{
			SourceText sourceText;
			var indent = CreateEngine("\nclass Foo\n{\n\tvoid Bar ()\n\t{\n$\n\t}\n}", out sourceText);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, FormattingOptionsFactory.CreateMono());

			var text = handler.FormatPlainText(sourceText, indent.Offset, "var str1 = \n@\"hello\";", null);
			Assert.AreEqual("\t\tvar str1 = \n\t\t\t@\"hello\";", text);
		}
		public void TestPasteComments()
		{
			SourceText sourceText;
			var indent = CreateEngine(@"
class Foo
{
	$
}", out sourceText);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, FormattingOptionsFactory.CreateMono());
			var text = handler.FormatPlainText(sourceText, indent.Offset, "// Foo\n\t// Foo 2\n\t// Foo 3", null);
			Assert.AreEqual("// Foo\n\t// Foo 2\n\t// Foo 3", text);
		}
		public void PasteVerbatimStringBug1()
		{
			var textEditorOptions = FormattingOptionsFactory.CreateMono();
			textEditorOptions = textEditorOptions.WithChangedOption(FormattingOptions.NewLine, LanguageNames.CSharp, "\r\n");
			SourceText sourceText;
			var indent = CreateEngine("\r\nclass Foo\r\n{\r\n\tvoid Bar ()\r\n\t{\r\n\t\t$\r\n\t}\r\n}", out sourceText, textEditorOptions);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, textEditorOptions);
			var text = handler.FormatPlainText(sourceText, indent.Offset, "Console.WriteLine (@\"Hello World!\", out sourceText);\n", null);
			Assert.AreEqual("Console.WriteLine (@\"Hello World!\", out sourceText);\r\n\t\t", text);
		}
		public void PasteVerbatimStringBug3()
		{
			SourceText sourceText;
			var indent = CreateEngine("\nclass Foo\n{\n\tvoid Bar ()\n\t{\n$\n\t}\n}", out sourceText);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, FormattingOptionsFactory.CreateMono());

			var text = handler.FormatPlainText(sourceText, indent.Offset, "\t\tSystem.Console.WriteLine(@\"<evlevlle>\", out sourceText);\n", null);
			Assert.AreEqual("\t\tSystem.Console.WriteLine(@\"<evlevlle>\", out sourceText);\n\t\t", text);
		}
		public void TestWindowsLineEndingCase2()
		{
			var options = FormattingOptionsFactory.CreateMono();
			options = options.WithChangedOption(FormattingOptions.NewLine, LanguageNames.CSharp, "\r\n");
			SourceText sourceText;
			var indent = CreateEngine("\r\nclass Foo\r\n{\r\n\tvoid Bar ()\r\n\t{\r\n\t\t$\r\n\t}\r\n}", out sourceText, options);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, options);
			var text = handler.FormatPlainText(sourceText, indent.Offset, "if (true)\r\nBar();\r\nTest();", null);
			Assert.AreEqual("if (true)\r\n\t\t\tBar();\r\n\t\tTest();", text);
		}
		public void TestPasteBlankLinesAndIndent()
		{
			SourceText sourceText;
			var indent = CreateEngine("class Foo\n{\n\tvoid Bar ()\n\t{\n\t\tSystem.Console.WriteLine ($);\n\t}\n}", out sourceText);
			var options = FormattingOptionsFactory.CreateMono();
//			options.EmptyLineFormatting = EmptyLineFormatting.Indent;
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, options);
			var text = handler.FormatPlainText(sourceText, indent.Offset, "\n\n\n", null);
			Assert.AreEqual("\n\t\t\t\n\t\t\t\n\t\t\t", text);
		}
		public void TestWindowsLineEnding()
		{
			SourceText sourceText;
			var indent = CreateEngine("\r\nclass Foo\r\n{\r\n\tvoid Bar ()\r\n\t{\r\n\t\t$\r\n\t}\r\n}", out sourceText);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, FormattingOptionsFactory.CreateMono());
			var text = handler.FormatPlainText(sourceText, indent.Offset, "Foo();\r\nBar();\r\nTest();", null);
			Assert.AreEqual("Foo();\n\t\tBar();\n\t\tTest();", text);
		}
		public void PasteVerbatimString()
		{
			SourceText sourceText;
			var indent = CreateEngine(@"
class Foo
{
void Bar ()
{
	
}
}", out sourceText);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, FormattingOptionsFactory.CreateMono());
			var str = "string str = @\"\n1\n\t2 \n\t\t3\n\";";
			var text = handler.FormatPlainText(sourceText, indent.Offset, str, null);
			Assert.AreEqual(str, text);
		}
		public void TestPasteNewLineCase2()
		{
			SourceText sourceText;
			var indent = CreateEngine(@"
class Foo
{
$	void Bar ()
	{
	}
}", out sourceText);
			ITextPasteHandler handler = new TextPasteIndentEngine(indent, FormattingOptionsFactory.CreateMono());
			var text = handler.FormatPlainText(sourceText, indent.Offset, "int i;\n", null);
			Assert.AreEqual("\tint i;\n", text);
		}