Beispiel #1
0
 public CodeFormatModule(CodeFormatHandler codeFormatHandler)
 {
     Post["/codeformat"] = x =>
         {
             var request = this.Bind<CodeFormatRequest>();
             return Response.AsJson(codeFormatHandler.Format(request));
         };
 }
        public void Should_format_code()
        {
            string code =
            @"public class Test {
            }";

            string expected =
            @"public class Test
            {
            }";
            var handler = new CodeFormatHandler();
            var buffer = handler.Format(new CodeFormatRequest {Buffer = code}).Buffer;
            buffer.ShouldEqual(expected);
        }
        public void Should_format_code()
        {
            string code =
@"public class Test {
}";

            string expected =
@"public class Test
{
}";
           
            var handler = new CodeFormatHandler(new OmniSharpConfiguration());
            var buffer = handler.Format(new CodeFormatRequest {Buffer = code}).Buffer;
			buffer.Replace("\r\n", "\n").ShouldEqual(expected);
        }