예제 #1
0
 public CodeFormatModule(CodeFormatHandler codeFormatHandler)
 {
     Post["/codeformat"] = x =>
         {
             var request = this.Bind<CodeFormatRequest>();
             return Response.AsJson(codeFormatHandler.Format(request));
         };
 }
예제 #2
0
 public CodeFormatModule(CodeFormatHandler codeFormatHandler)
 {
     Post["CodeFormat", "/codeformat"] = x =>
     {
         var request = this.Bind <CodeFormatRequest>();
         return(Response.AsJson(codeFormatHandler.Format(request)));
     };
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }