~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// TestStatementIndentation.cs
 
3
//  
 
4
// Author:
 
5
//       Mike KrĆ¼ger <mkrueger@novell.com>
 
6
// 
 
7
// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
 
8
// 
 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
10
// of this software and associated documentation files (the "Software"), to deal
 
11
// in the Software without restriction, including without limitation the rights
 
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
13
// copies of the Software, and to permit persons to whom the Software is
 
14
// furnished to do so, subject to the following conditions:
 
15
// 
 
16
// The above copyright notice and this permission notice shall be included in
 
17
// all copies or substantial portions of the Software.
 
18
// 
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
25
// THE SOFTWARE.
 
26
 
 
27
using System;
 
28
using System.IO;
 
29
using NUnit.Framework;
 
30
using ICSharpCode.NRefactory.CSharp;
 
31
 
 
32
namespace ICSharpCode.NRefactory.CSharp.FormattingTests
 
33
{
 
34
        [TestFixture()]
 
35
        public class TestStatements : TestBase
 
36
        {
 
37
                [Test]
 
38
                public void TestInvocationIndentation ()
 
39
                {
 
40
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
41
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
42
                        
 
43
                        Test (policy,
 
44
@"class Test {
 
45
        Test TestMethod ()
 
46
        {
 
47
this.TestMethod ();
 
48
        }
 
49
}",
 
50
@"class Test {
 
51
        Test TestMethod ()
 
52
        {
 
53
                this.TestMethod ();
 
54
        }
 
55
}");
 
56
                }
 
57
 
 
58
                [Test]
 
59
                public void TestIndentBlocks ()
 
60
                {
 
61
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
62
                        policy.IndentBlocks = true;
 
63
                        
 
64
                        var adapter = Test (policy,
 
65
@"class Test {
 
66
        Test TestMethod ()
 
67
        {
 
68
{
 
69
{}
 
70
}
 
71
        }
 
72
}",
 
73
@"class Test
 
74
{
 
75
        Test TestMethod ()
 
76
        {
 
77
                {
 
78
                        {}
 
79
                }
 
80
        }
 
81
}");
 
82
                        policy.IndentBlocks = false;
 
83
                        Continue (policy, adapter, @"class Test
 
84
{
 
85
        Test TestMethod ()
 
86
        {
 
87
                {
 
88
                {}
 
89
                }
 
90
        }
 
91
}");
 
92
                }
 
93
                
 
94
                [Test]
 
95
                public void TestIndentBlocksCase2 ()
 
96
                {
 
97
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
98
                        policy.IndentBlocks = true;
 
99
                        
 
100
                        var adapter = Test (policy,
 
101
@"class Test {
 
102
        Test TestMethod ()
 
103
        {
 
104
                if (true) {
 
105
                Something ();
 
106
                }
 
107
        }
 
108
}",
 
109
@"class Test
 
110
{
 
111
        Test TestMethod ()
 
112
        {
 
113
                if (true) {
 
114
                        Something ();
 
115
                }
 
116
        }
 
117
}");
 
118
                        policy.IndentBlocks = false;
 
119
                        Continue (policy, adapter, @"class Test
 
120
{
 
121
        Test TestMethod ()
 
122
        {
 
123
                if (true) {
 
124
                Something ();
 
125
                }
 
126
        }
 
127
}");
 
128
                }
 
129
 
 
130
                [Test]
 
131
                public void TestBreakIndentation ()
 
132
                {
 
133
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
134
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
135
                        
 
136
                        Test (policy, 
 
137
@"class Test {
 
138
        Test TestMethod ()
 
139
        {
 
140
                              break;
 
141
        }
 
142
}",
 
143
@"class Test {
 
144
        Test TestMethod ()
 
145
        {
 
146
                break;
 
147
        }
 
148
}");
 
149
                }
 
150
 
 
151
                [Test]
 
152
                public void TestBreakSemicolon ()
 
153
                {
 
154
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
155
 
 
156
                        Test (policy, 
 
157
@"class Test
 
158
{
 
159
        Test TestMethod ()
 
160
        {
 
161
                break     ;
 
162
        }
 
163
}",
 
164
@"class Test
 
165
{
 
166
        Test TestMethod ()
 
167
        {
 
168
                break;
 
169
        }
 
170
}");
 
171
                }
 
172
 
 
173
                [Test]
 
174
                public void TestCheckedIndentation ()
 
175
                {
 
176
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
177
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
178
                        
 
179
                        
 
180
                        Test (policy, @"class Test {
 
181
        Test TestMethod ()
 
182
        {
 
183
checked {
 
184
}
 
185
        }
 
186
}", @"class Test {
 
187
        Test TestMethod ()
 
188
        {
 
189
                checked {
 
190
                }
 
191
        }
 
192
}");
 
193
                }
 
194
 
 
195
                [Test]
 
196
                public void TestBaseIndentation ()
 
197
                {
 
198
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
199
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
200
                        
 
201
                        Test (policy, @"class Test {
 
202
        Test TestMethod ()
 
203
        {
 
204
                              base.FooBar();
 
205
        }
 
206
}", @"class Test {
 
207
        Test TestMethod ()
 
208
        {
 
209
                base.FooBar ();
 
210
        }
 
211
}");
 
212
                }
 
213
 
 
214
                [Test]
 
215
                public void TestUncheckedIndentation ()
 
216
                {
 
217
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
218
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
219
                        
 
220
                        Test (policy, @"class Test {
 
221
        Test TestMethod ()
 
222
        {
 
223
unchecked {
 
224
}
 
225
        }
 
226
}", 
 
227
@"class Test {
 
228
        Test TestMethod ()
 
229
        {
 
230
                unchecked {
 
231
                }
 
232
        }
 
233
}");
 
234
                }
 
235
 
 
236
                [Test]
 
237
                public void TestContinueIndentation ()
 
238
                {
 
239
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
240
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
241
                        
 
242
                        Test (policy, @"class Test {
 
243
        Test TestMethod ()
 
244
        {
 
245
continue;
 
246
        }
 
247
}",
 
248
@"class Test {
 
249
        Test TestMethod ()
 
250
        {
 
251
                continue;
 
252
        }
 
253
}");
 
254
                }
 
255
 
 
256
                [Test]
 
257
                public void TestContinueSemicolon ()
 
258
                {
 
259
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
260
                        Test (policy, @"class Test
 
261
{
 
262
        Test TestMethod ()
 
263
        {
 
264
                continue ;
 
265
        }
 
266
}",
 
267
@"class Test
 
268
{
 
269
        Test TestMethod ()
 
270
        {
 
271
                continue;
 
272
        }
 
273
}");
 
274
                }
 
275
 
 
276
                [Test]
 
277
                public void TestEmptyStatementIndentation ()
 
278
                {
 
279
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
280
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
281
                        
 
282
                        Test (policy, @"class Test {
 
283
        Test TestMethod ()
 
284
        {
 
285
;
 
286
        }
 
287
}", @"class Test {
 
288
        Test TestMethod ()
 
289
        {
 
290
                ;
 
291
        }
 
292
}");
 
293
                }
 
294
 
 
295
                [Test]
 
296
                public void TestFixedStatementIndentation ()
 
297
                {
 
298
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
299
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
300
                        
 
301
                        Test (policy, @"class Test {
 
302
        Test TestMethod ()
 
303
        {
 
304
fixed (object* obj = &obj)
 
305
;
 
306
        }
 
307
}",
 
308
@"class Test {
 
309
        Test TestMethod ()
 
310
        {
 
311
                fixed (object* obj = &obj)
 
312
                        ;
 
313
        }
 
314
}");
 
315
                }
 
316
 
 
317
                [Test]
 
318
                public void TestForeachIndentation ()
 
319
                {
 
320
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
321
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
322
                        
 
323
                        Test (policy, @"class Test
 
324
{
 
325
        Test TestMethod ()
 
326
        {
 
327
foreach (var obj in col) {
 
328
}
 
329
        }
 
330
}", @"class Test
 
331
{
 
332
        Test TestMethod ()
 
333
        {
 
334
                foreach (var obj in col) {
 
335
                }
 
336
        }
 
337
}");
 
338
                }
 
339
 
 
340
                [Test]
 
341
                public void TestForIndentation ()
 
342
                {
 
343
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
344
                        
 
345
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
346
                        
 
347
                        Test (policy, @"class Test {
 
348
        Test TestMethod ()
 
349
        {
 
350
for (;;) {
 
351
}
 
352
        }
 
353
}", @"class Test {
 
354
        Test TestMethod ()
 
355
        {
 
356
                for (;;) {
 
357
                }
 
358
        }
 
359
}");
 
360
                }
 
361
 
 
362
                [Test]
 
363
                public void TestGotoIndentation ()
 
364
                {
 
365
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
366
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
367
                        
 
368
                        Test (policy, @"class Test {
 
369
        Test TestMethod ()
 
370
        {
 
371
goto label;
 
372
        }
 
373
}",
 
374
@"class Test {
 
375
        Test TestMethod ()
 
376
        {
 
377
                goto label;
 
378
        }
 
379
}");
 
380
                }
 
381
 
 
382
                [Test]
 
383
                public void TestGotoSemicolon ()
 
384
                {
 
385
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
386
                        Test (policy, @"class Test
 
387
{
 
388
        Test TestMethod ()
 
389
        {
 
390
                goto label
 
391
;
 
392
        }
 
393
}",
 
394
@"class Test
 
395
{
 
396
        Test TestMethod ()
 
397
        {
 
398
                goto label;
 
399
        }
 
400
}");
 
401
                }
 
402
 
 
403
                [Test]
 
404
                public void TestReturnIndentation ()
 
405
                {
 
406
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
407
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
408
                        
 
409
                        Test (policy, @"class Test {
 
410
        Test TestMethod ()
 
411
        {
 
412
                return;
 
413
        }
 
414
}",
 
415
@"class Test {
 
416
        Test TestMethod ()
 
417
        {
 
418
                return;
 
419
        }
 
420
}");
 
421
                }
 
422
 
 
423
                [Test]
 
424
                public void TestReturnSemicolon ()
 
425
                {
 
426
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
427
                        Test (policy, @"class Test
 
428
{
 
429
        Test TestMethod ()
 
430
        {
 
431
                return ;
 
432
        }
 
433
}",
 
434
@"class Test
 
435
{
 
436
        Test TestMethod ()
 
437
        {
 
438
                return;
 
439
        }
 
440
}");
 
441
                }
 
442
                [Test]
 
443
                public void TestLockIndentation ()
 
444
                {
 
445
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
446
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
447
                        
 
448
                        Test (policy, @"class Test {
 
449
        Test TestMethod ()
 
450
        {
 
451
lock (this) {
 
452
}
 
453
        }
 
454
}",
 
455
@"class Test {
 
456
        Test TestMethod ()
 
457
        {
 
458
                lock (this) {
 
459
                }
 
460
        }
 
461
}");
 
462
                }
 
463
 
 
464
                [Test]
 
465
                public void TestThrowIndentation ()
 
466
                {
 
467
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
468
                        
 
469
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
470
                        
 
471
                        Test (policy, @"class Test {
 
472
        Test TestMethod ()
 
473
        {
 
474
throw new NotSupportedException ();
 
475
        }
 
476
}",
 
477
@"class Test {
 
478
        Test TestMethod ()
 
479
        {
 
480
                throw new NotSupportedException ();
 
481
        }
 
482
}");
 
483
                }
 
484
 
 
485
                [Test]
 
486
                public void TestThrowSemicolon ()
 
487
                {
 
488
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
489
                        Test (policy, @"class Test
 
490
{
 
491
        Test TestMethod ()
 
492
        {
 
493
                throw new NotSupportedException ()       ;
 
494
        }
 
495
}",
 
496
@"class Test
 
497
{
 
498
        Test TestMethod ()
 
499
        {
 
500
                throw new NotSupportedException ();
 
501
        }
 
502
}");
 
503
                }
 
504
 
 
505
                [Test]
 
506
                public void TestUnsafeIndentation ()
 
507
                {
 
508
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
509
                        
 
510
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
511
                        
 
512
                        Test (policy, @"class Test {
 
513
        Test TestMethod ()
 
514
        {
 
515
unsafe {
 
516
}
 
517
        }
 
518
}",
 
519
@"class Test {
 
520
        Test TestMethod ()
 
521
        {
 
522
                unsafe {
 
523
                }
 
524
        }
 
525
}");
 
526
                }
 
527
 
 
528
                [Test]
 
529
                public void TestUsingIndentation ()
 
530
                {
 
531
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
532
                        
 
533
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
534
                        
 
535
                        Test (policy, @"class Test {
 
536
        Test TestMethod ()
 
537
        {
 
538
using (var o = new MyObj()) {
 
539
}
 
540
        }
 
541
}", @"class Test {
 
542
        Test TestMethod ()
 
543
        {
 
544
                using (var o = new MyObj()) {
 
545
                }
 
546
        }
 
547
}");
 
548
                }
 
549
 
 
550
                [Test]
 
551
                public void TestUsingAlignment ()
 
552
                {
 
553
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
554
                        policy.AlignEmbeddedUsingStatements = true;
 
555
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
556
                        
 
557
                        var adapter = Test (policy, @"class Test {
 
558
        Test TestMethod ()
 
559
        {
 
560
using (var p = new MyObj())
 
561
using (var o = new MyObj()) {
 
562
}
 
563
        }
 
564
}",
 
565
@"class Test {
 
566
        Test TestMethod ()
 
567
        {
 
568
                using (var p = new MyObj())
 
569
                using (var o = new MyObj()) {
 
570
                }
 
571
        }
 
572
}");
 
573
                        policy.AlignEmbeddedUsingStatements = false;
 
574
                        Continue (policy, adapter, @"class Test {
 
575
        Test TestMethod ()
 
576
        {
 
577
                using (var p = new MyObj())
 
578
                        using (var o = new MyObj()) {
 
579
                        }
 
580
        }
 
581
}");
 
582
                }
 
583
 
 
584
                [Test]
 
585
                public void TestVariableDeclarationIndentation ()
 
586
                {
 
587
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
588
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
589
                        
 
590
                        Test (policy, @"class Test {
 
591
        Test TestMethod ()
 
592
        {
 
593
Test a;
 
594
        }
 
595
}",
 
596
@"class Test {
 
597
        Test TestMethod ()
 
598
        {
 
599
                Test a;
 
600
        }
 
601
}");
 
602
                }
 
603
 
 
604
                [Test]
 
605
                public void TestConstantVariableDeclarationIndentation ()
 
606
                {
 
607
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
608
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
609
                        
 
610
                        Test (policy, @"class Test {
 
611
        Test TestMethod ()
 
612
        {
 
613
const int a = 5;
 
614
        }
 
615
}",
 
616
@"class Test {
 
617
        Test TestMethod ()
 
618
        {
 
619
                const int a = 5;
 
620
        }
 
621
}");
 
622
                }
 
623
 
 
624
                [Test]
 
625
                public void TestYieldReturnIndentation ()
 
626
                {
 
627
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
628
                        
 
629
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
630
                        Test (policy, @"class Test {
 
631
        Test TestMethod ()
 
632
        {
 
633
yield return null;
 
634
        }
 
635
}",
 
636
@"class Test {
 
637
        Test TestMethod ()
 
638
        {
 
639
                yield return null;
 
640
        }
 
641
}");
 
642
                }
 
643
 
 
644
                [Test]
 
645
                public void TestYieldReturnSemicolon ()
 
646
                {
 
647
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
648
                        
 
649
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
650
                        Test (policy, @"class Test {
 
651
        Test TestMethod ()
 
652
        {
 
653
                yield return null     ;
 
654
        }
 
655
}",
 
656
@"class Test {
 
657
        Test TestMethod ()
 
658
        {
 
659
                yield return null;
 
660
        }
 
661
}");
 
662
                }
 
663
 
 
664
                [Test]
 
665
                public void TestYieldBreakIndentation ()
 
666
                {
 
667
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
668
                        
 
669
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
670
                        Test (policy, @"class Test {
 
671
        Test TestMethod ()
 
672
        {
 
673
yield break;
 
674
        }
 
675
}",
 
676
@"class Test {
 
677
        Test TestMethod ()
 
678
        {
 
679
                yield break;
 
680
        }
 
681
}");
 
682
                }
 
683
 
 
684
                [Test]
 
685
                public void TestYieldBreakSemicolon ()
 
686
                {
 
687
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
688
                        
 
689
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
690
                        Test (policy, @"class Test {
 
691
        Test TestMethod ()
 
692
        {
 
693
                yield break      ;
 
694
        }
 
695
}",
 
696
@"class Test {
 
697
        Test TestMethod ()
 
698
        {
 
699
                yield break;
 
700
        }
 
701
}");
 
702
                }
 
703
                [Test]
 
704
                public void TestWhileIndentation ()
 
705
                {
 
706
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
707
                        
 
708
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
709
                        
 
710
                        Test (policy, @"class Test {
 
711
        Test TestMethod ()
 
712
        {
 
713
while (true)
 
714
;
 
715
        }
 
716
}",
 
717
@"class Test {
 
718
        Test TestMethod ()
 
719
        {
 
720
                while (true)
 
721
                        ;
 
722
        }
 
723
}");
 
724
                }
 
725
 
 
726
                [Test]
 
727
                public void TestDoWhileIndentation ()
 
728
                {
 
729
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
730
                        
 
731
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
732
                        Test (policy, @"class Test {
 
733
        Test TestMethod ()
 
734
        {
 
735
do {
 
736
} while (true);
 
737
        }
 
738
}",
 
739
@"class Test {
 
740
        Test TestMethod ()
 
741
        {
 
742
                do {
 
743
                } while (true);
 
744
        }
 
745
}");
 
746
                }
 
747
 
 
748
                [Test]
 
749
                public void TestForeachBracketPlacement ()
 
750
                {
 
751
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
752
                        
 
753
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
754
                        Test (policy, @"class Test
 
755
{
 
756
        Test TestMethod ()
 
757
        {
 
758
                foreach (var obj in col) {}
 
759
        }
 
760
}",
 
761
@"class Test
 
762
{
 
763
        Test TestMethod ()
 
764
        {
 
765
                foreach (var obj in col) {
 
766
                }
 
767
        }
 
768
}");
 
769
                }
 
770
 
 
771
                [Test]
 
772
                public void TestForeachBracketPlacement2 ()
 
773
                {
 
774
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
775
                        
 
776
                        policy.StatementBraceStyle = BraceStyle.NextLineShifted2;
 
777
                        Test (policy, @"class Test
 
778
{
 
779
        Test TestMethod ()
 
780
        {
 
781
                foreach (var obj in col) {;}
 
782
        }
 
783
}",
 
784
@"class Test
 
785
{
 
786
        Test TestMethod ()
 
787
        {
 
788
                foreach (var obj in col)
 
789
                        {
 
790
                                ;
 
791
                        }
 
792
        }
 
793
}");
 
794
                }
 
795
 
 
796
                [Test]
 
797
                public void TestIfBracketPlacement ()
 
798
                {
 
799
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
800
                        
 
801
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
802
                        
 
803
                        Test (policy, @"class Test
 
804
{
 
805
        Test TestMethod ()
 
806
        {
 
807
                if (true) {}
 
808
        }
 
809
}",
 
810
@"class Test
 
811
{
 
812
        Test TestMethod ()
 
813
        {
 
814
                if (true) {
 
815
                }
 
816
        }
 
817
}");
 
818
                }
 
819
 
 
820
                [Test]
 
821
                public void TestAllowIfBlockInline ()
 
822
                {
 
823
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
824
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
825
                        policy.AllowIfBlockInline = true;
 
826
                        
 
827
                        Test (policy, @"class Test
 
828
{
 
829
        Test TestMethod ()
 
830
        {
 
831
                if (true) {}
 
832
        }
 
833
}", @"class Test
 
834
{
 
835
        Test TestMethod ()
 
836
        {
 
837
                if (true) {}
 
838
        }
 
839
}");
 
840
                        
 
841
                        
 
842
                        Test (policy, @"class Test
 
843
{
 
844
        Test TestMethod ()
 
845
        {
 
846
                if (true) { Foo (); }
 
847
        }
 
848
}", @"class Test
 
849
{
 
850
        Test TestMethod ()
 
851
        {
 
852
                if (true) { Foo (); }
 
853
        }
 
854
}");
 
855
                        
 
856
                        
 
857
                        Test (policy, @"class Test
 
858
{
 
859
        Test TestMethod ()
 
860
        {
 
861
                if (true) Foo ();
 
862
        }
 
863
}", @"class Test
 
864
{
 
865
        Test TestMethod ()
 
866
        {
 
867
                if (true) Foo ();
 
868
        }
 
869
}");
 
870
                        
 
871
                        
 
872
                        Test (policy, @"class Test
 
873
{
 
874
        Test TestMethod ()
 
875
        {
 
876
                if (true)
 
877
                        Foo ();
 
878
        }
 
879
}",
 
880
@"class Test
 
881
{
 
882
        Test TestMethod ()
 
883
        {
 
884
                if (true)
 
885
                        Foo ();
 
886
        }
 
887
}");
 
888
                }
 
889
 
 
890
                [Test]
 
891
                public void TestIfElseBracketPlacement ()
 
892
                {
 
893
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
894
                        
 
895
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
896
                        
 
897
                        Test (policy, @"class Test
 
898
{
 
899
        Test TestMethod ()
 
900
        {
 
901
                if (true) {} else {}
 
902
        }
 
903
}",
 
904
@"class Test
 
905
{
 
906
        Test TestMethod ()
 
907
        {
 
908
                if (true) {
 
909
                } else {
 
910
                }
 
911
        }
 
912
}");
 
913
                }
 
914
 
 
915
                [Test]
 
916
                public void TestIfAlignment ()
 
917
                {
 
918
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
919
                        policy.AlignEmbeddedIfStatements = true;
 
920
                        policy.ClassBraceStyle = BraceStyle.EndOfLine;
 
921
                        
 
922
                        var adapter = Test (policy, @"class Test {
 
923
        Test TestMethod ()
 
924
        {
 
925
if (a)
 
926
if (b) {
 
927
}
 
928
        }
 
929
}",
 
930
@"class Test {
 
931
        Test TestMethod ()
 
932
        {
 
933
                if (a)
 
934
                if (b) {
 
935
                }
 
936
        }
 
937
}");
 
938
                        policy.AlignEmbeddedIfStatements = false;
 
939
                        Continue (policy, adapter, @"class Test {
 
940
        Test TestMethod ()
 
941
        {
 
942
                if (a)
 
943
                        if (b) {
 
944
                        }
 
945
        }
 
946
}");
 
947
                }
 
948
 
 
949
                [Test]
 
950
                public void TestElseOnNewLine()
 
951
                {
 
952
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono();
 
953
                        policy.ElseNewLinePlacement = NewLinePlacement.NewLine;
 
954
                        
 
955
                        Test (policy, @"class Test
 
956
{
 
957
        Test TestMethod ()
 
958
        {
 
959
                if (true) {
 
960
                        ;
 
961
                } else if (false) {
 
962
                        ;
 
963
                }
 
964
        }
 
965
}",
 
966
@"class Test
 
967
{
 
968
        Test TestMethod ()
 
969
        {
 
970
                if (true) {
 
971
                        ;
 
972
                }
 
973
                else if (false) {
 
974
                        ;
 
975
                }
 
976
        }
 
977
}");
 
978
                }
 
979
 
 
980
                [Test]
 
981
                public void TestElseIfOnNewLine()
 
982
                {
 
983
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono();
 
984
                        policy.ElseIfNewLinePlacement = NewLinePlacement.NewLine;
 
985
                        
 
986
                        Test (policy, @"class Test
 
987
{
 
988
        Test TestMethod ()
 
989
        {
 
990
                if (true) {
 
991
                        ;
 
992
                } else if (false) {
 
993
                        ;
 
994
                }
 
995
        }
 
996
}",
 
997
@"class Test
 
998
{
 
999
        Test TestMethod ()
 
1000
        {
 
1001
                if (true) {
 
1002
                        ;
 
1003
                } else
 
1004
                if (false) {
 
1005
                        ;
 
1006
                }
 
1007
        }
 
1008
}");
 
1009
                }
 
1010
 
 
1011
                [Test]
 
1012
                public void TestElseOnNewLineOff()
 
1013
                {
 
1014
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono();
 
1015
                        policy.ElseNewLinePlacement = NewLinePlacement.SameLine;
 
1016
                        
 
1017
                        Test (policy, @"class Test
 
1018
{
 
1019
        Test TestMethod ()
 
1020
        {
 
1021
                if (true) {
 
1022
                        ;
 
1023
                }
 
1024
                else if (false) {
 
1025
                        ;
 
1026
                }
 
1027
        }
 
1028
}",
 
1029
@"class Test
 
1030
{
 
1031
        Test TestMethod ()
 
1032
        {
 
1033
                if (true) {
 
1034
                        ;
 
1035
                } else if (false) {
 
1036
                        ;
 
1037
                }
 
1038
        }
 
1039
}");
 
1040
                }
 
1041
 
 
1042
                [Test]
 
1043
                public void TestSimpleIfElseComment()
 
1044
                {
 
1045
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono();
 
1046
                        
 
1047
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
1048
                        policy.ElseIfNewLinePlacement = NewLinePlacement.SameLine; // for simple statements it must be new line.
 
1049
                        
 
1050
                        Test (policy, @"class Test
 
1051
{
 
1052
        void TestMethod ()
 
1053
        {
 
1054
                if (true) Call (); else Call ();
 
1055
        }
 
1056
}",
 
1057
@"class Test
 
1058
{
 
1059
        void TestMethod ()
 
1060
        {
 
1061
                if (true)
 
1062
                        Call ();
 
1063
                else
 
1064
                        Call ();
 
1065
        }
 
1066
}");
 
1067
                }
 
1068
 
 
1069
                [Test]
 
1070
                public void TestFixedBracketPlacement ()
 
1071
                {
 
1072
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1073
                        
 
1074
                        policy.StatementBraceStyle = BraceStyle.NextLineShifted;
 
1075
 
 
1076
                        Test (policy, @"class Test
 
1077
{
 
1078
        Test TestMethod ()
 
1079
        {
 
1080
                fixed (object* obj = &obj){
 
1081
 
 
1082
;}
 
1083
        }
 
1084
}",
 
1085
@"class Test
 
1086
{
 
1087
        Test TestMethod ()
 
1088
        {
 
1089
                fixed (object* obj = &obj)
 
1090
                        {
 
1091
 
 
1092
                        ;
 
1093
                        }
 
1094
        }
 
1095
}");
 
1096
                }
 
1097
 
 
1098
                [Test]
 
1099
                public void TestForBracketPlacement ()
 
1100
                {
 
1101
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1102
                        
 
1103
                        policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace;
 
1104
                        Test (policy, @"class Test
 
1105
{
 
1106
        Test TestMethod ()
 
1107
        {
 
1108
                for (;;) {;}
 
1109
        }
 
1110
}",
 
1111
@"class Test
 
1112
{
 
1113
        Test TestMethod ()
 
1114
        {
 
1115
                for (;;){
 
1116
                        ;
 
1117
                }
 
1118
        }
 
1119
}");
 
1120
                }
 
1121
 
 
1122
                [Test]
 
1123
                public void TestCheckedBracketPlacement ()
 
1124
                {
 
1125
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1126
                        
 
1127
                        policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace;
 
1128
                        
 
1129
                        Test (policy, @"class Test
 
1130
{
 
1131
        Test TestMethod ()
 
1132
        {
 
1133
                checked {;}
 
1134
        }
 
1135
}",
 
1136
@"class Test
 
1137
{
 
1138
        Test TestMethod ()
 
1139
        {
 
1140
                checked{
 
1141
                        ;
 
1142
                }
 
1143
        }
 
1144
}");
 
1145
                }
 
1146
 
 
1147
                [Test]
 
1148
                public void TestUncheckedBracketPlacement ()
 
1149
                {
 
1150
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1151
                        
 
1152
                        policy.StatementBraceStyle = BraceStyle.EndOfLineWithoutSpace;
 
1153
                        
 
1154
                        Test (policy, @"class Test
 
1155
{
 
1156
        Test TestMethod ()
 
1157
        {
 
1158
                unchecked {;}
 
1159
        }
 
1160
}",
 
1161
@"class Test
 
1162
{
 
1163
        Test TestMethod ()
 
1164
        {
 
1165
                unchecked{
 
1166
                        ;
 
1167
                }
 
1168
        }
 
1169
}");
 
1170
                }
 
1171
 
 
1172
                [Test]
 
1173
                public void TestLockBracketPlacement ()
 
1174
                {
 
1175
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1176
                        
 
1177
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
1178
                        
 
1179
                        Test (policy, @"class Test
 
1180
{
 
1181
        Test TestMethod ()
 
1182
        {
 
1183
                lock (this)
 
1184
                {
 
1185
                        ;
 
1186
                }
 
1187
        }
 
1188
}",
 
1189
@"class Test
 
1190
{
 
1191
        Test TestMethod ()
 
1192
        {
 
1193
                lock (this) {
 
1194
                        ;
 
1195
                }
 
1196
        }
 
1197
}");
 
1198
                }
 
1199
 
 
1200
                [Test]
 
1201
                public void TestUnsafeBracketPlacement ()
 
1202
                {
 
1203
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1204
                        
 
1205
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
1206
                        
 
1207
                        Test (policy, @"class Test
 
1208
{
 
1209
        Test TestMethod ()
 
1210
        {
 
1211
                unsafe
 
1212
                {
 
1213
                        ;
 
1214
                }
 
1215
        }
 
1216
}",
 
1217
@"class Test
 
1218
{
 
1219
        Test TestMethod ()
 
1220
        {
 
1221
                unsafe {
 
1222
                        ;
 
1223
                }
 
1224
        }
 
1225
}");
 
1226
                }
 
1227
 
 
1228
                [Test]
 
1229
                public void TestUsingBracketPlacement ()
 
1230
                {
 
1231
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1232
                        
 
1233
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
1234
                        
 
1235
                        Test (policy, @"class Test
 
1236
{
 
1237
        Test TestMethod ()
 
1238
        {
 
1239
                using (var e = new E())
 
1240
                {
 
1241
                        ;
 
1242
                }
 
1243
        }
 
1244
}",
 
1245
@"class Test
 
1246
{
 
1247
        Test TestMethod ()
 
1248
        {
 
1249
                using (var e = new E()) {
 
1250
                        ;
 
1251
                }
 
1252
        }
 
1253
}");
 
1254
                }
 
1255
 
 
1256
                [Test]
 
1257
                public void TestWhileBracketPlacement ()
 
1258
                {
 
1259
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1260
                        
 
1261
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
1262
                        
 
1263
                        Test (policy, @"class Test
 
1264
{
 
1265
        Test TestMethod ()
 
1266
        {
 
1267
                while (true)
 
1268
                {
 
1269
                        ;
 
1270
                }
 
1271
        }
 
1272
}",
 
1273
@"class Test
 
1274
{
 
1275
        Test TestMethod ()
 
1276
        {
 
1277
                while (true) {
 
1278
                        ;
 
1279
                }
 
1280
        }
 
1281
}");
 
1282
                }
 
1283
 
 
1284
                [Test]
 
1285
                public void TestDoWhileBracketPlacement ()
 
1286
                {
 
1287
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1288
                        
 
1289
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
1290
                        
 
1291
                        Test (policy, @"class Test
 
1292
{
 
1293
        Test TestMethod ()
 
1294
        {
 
1295
                do
 
1296
                {
 
1297
                        ;
 
1298
                } while (true);
 
1299
        }
 
1300
}",
 
1301
@"class Test
 
1302
{
 
1303
        Test TestMethod ()
 
1304
        {
 
1305
                do {
 
1306
                        ;
 
1307
                } while (true);
 
1308
        }
 
1309
}");
 
1310
                }
 
1311
 
 
1312
                [Test]
 
1313
                public void TestSwitchFormatting1 ()
 
1314
                {
 
1315
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1316
                        
 
1317
                        policy.IndentSwitchBody = true;
 
1318
                        policy.IndentCaseBody = true;
 
1319
                        policy.IndentBreakStatements = true;
 
1320
                        
 
1321
                        Test (policy, @"class Test
 
1322
{
 
1323
        Test TestMethod ()
 
1324
        {
 
1325
                switch (a) { case 1: case 2: DoSomething(); break; default: Foo (); break;}
 
1326
        }
 
1327
}",
 
1328
@"class Test
 
1329
{
 
1330
        Test TestMethod ()
 
1331
        {
 
1332
                switch (a) {
 
1333
                        case 1:
 
1334
                        case 2:
 
1335
                                DoSomething ();
 
1336
                                break;
 
1337
                        default:
 
1338
                                Foo ();
 
1339
                                break;
 
1340
                }
 
1341
        }
 
1342
}");
 
1343
                }
 
1344
 
 
1345
                [Test]
 
1346
                public void TestSwitchFormatting2 ()
 
1347
                {
 
1348
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1349
                        
 
1350
                        policy.IndentSwitchBody = false;
 
1351
                        policy.IndentCaseBody = false;
 
1352
                        policy.IndentBreakStatements = false;
 
1353
                        
 
1354
                        Test (policy, @"class Test
 
1355
{
 
1356
        Test TestMethod ()
 
1357
        {
 
1358
                switch (a) { case 1: case 2: DoSomething(); break; default: Foo (); break;}
 
1359
        }
 
1360
}",
 
1361
@"class Test
 
1362
{
 
1363
        Test TestMethod ()
 
1364
        {
 
1365
                switch (a) {
 
1366
                case 1:
 
1367
                case 2:
 
1368
                DoSomething ();
 
1369
                break;
 
1370
                default:
 
1371
                Foo ();
 
1372
                break;
 
1373
                }
 
1374
        }
 
1375
}");
 
1376
                }
 
1377
                
 
1378
                
 
1379
                [Test]
 
1380
                public void TestSwitchIndentBreak ()
 
1381
                {
 
1382
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1383
                        
 
1384
                        policy.IndentSwitchBody = true;
 
1385
                        policy.IndentBreakStatements = true;
 
1386
                        
 
1387
                        Test (policy, @"class Test
 
1388
{
 
1389
        Test TestMethod ()
 
1390
        {
 
1391
                switch (a) {
 
1392
                        case 1:
 
1393
                        case 2:
 
1394
                        DoSomething ();
 
1395
                        break;
 
1396
                        default:
 
1397
                        Foo ();
 
1398
                        break;
 
1399
                }
 
1400
        }
 
1401
}",
 
1402
@"class Test
 
1403
{
 
1404
        Test TestMethod ()
 
1405
        {
 
1406
                switch (a) {
 
1407
                        case 1:
 
1408
                        case 2:
 
1409
                                DoSomething ();
 
1410
                                break;
 
1411
                        default:
 
1412
                                Foo ();
 
1413
                                break;
 
1414
                }
 
1415
        }
 
1416
}");
 
1417
                        policy.IndentSwitchBody = true;
 
1418
                        policy.IndentBreakStatements = false;
 
1419
                        
 
1420
                        Test (policy, @"class Test
 
1421
{
 
1422
        Test TestMethod ()
 
1423
        {
 
1424
                switch (a) {
 
1425
                        case 1:
 
1426
                        case 2:
 
1427
                        DoSomething ();
 
1428
                        break;
 
1429
                        default:
 
1430
                        Foo ();
 
1431
                        break;
 
1432
                }
 
1433
        }
 
1434
}",
 
1435
@"class Test
 
1436
{
 
1437
        Test TestMethod ()
 
1438
        {
 
1439
                switch (a) {
 
1440
                        case 1:
 
1441
                        case 2:
 
1442
                                DoSomething ();
 
1443
                        break;
 
1444
                        default:
 
1445
                                Foo ();
 
1446
                        break;
 
1447
                }
 
1448
        }
 
1449
}");
 
1450
                }
 
1451
 
 
1452
 
 
1453
                [Test]
 
1454
                public void TestTryCatchBracketPlacement ()
 
1455
                {
 
1456
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1457
                        
 
1458
                        policy.StatementBraceStyle = BraceStyle.EndOfLine;
 
1459
                        
 
1460
                        Test (policy, @"class Test
 
1461
{
 
1462
        Test TestMethod ()
 
1463
        {
 
1464
                try { ; } catch (Exception e) { } finally { }
 
1465
        }
 
1466
}",
 
1467
@"class Test
 
1468
{
 
1469
        Test TestMethod ()
 
1470
        {
 
1471
                try {
 
1472
                        ;
 
1473
                } catch (Exception e) {
 
1474
                } finally {
 
1475
                }
 
1476
        }
 
1477
}");
 
1478
                }
 
1479
 
 
1480
                [Test]
 
1481
                public void TestPlaceCatchOnNewLine()
 
1482
                {
 
1483
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono();
 
1484
                        
 
1485
                        policy.CatchNewLinePlacement = NewLinePlacement.NewLine;
 
1486
                        
 
1487
                        Test (policy, @"class Test
 
1488
{
 
1489
        Test TestMethod ()
 
1490
        {
 
1491
                try {
 
1492
                        ;
 
1493
                } catch (Exception e) {
 
1494
                } finally {
 
1495
                }
 
1496
        }
 
1497
}",
 
1498
@"class Test
 
1499
{
 
1500
        Test TestMethod ()
 
1501
        {
 
1502
                try {
 
1503
                        ;
 
1504
                }
 
1505
                catch (Exception e) {
 
1506
                } finally {
 
1507
                }
 
1508
        }
 
1509
}");
 
1510
                }
 
1511
 
 
1512
                [Test]
 
1513
                public void TestPlaceFinallyOnNewLine()
 
1514
                {
 
1515
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono();
 
1516
                        policy.FinallyNewLinePlacement = NewLinePlacement.NewLine;
 
1517
                        
 
1518
                        Test (policy, @"class Test
 
1519
{
 
1520
        Test TestMethod ()
 
1521
        {
 
1522
                try {
 
1523
                        ;
 
1524
                } catch (Exception e) {
 
1525
                } finally {
 
1526
                }
 
1527
        }
 
1528
}",
 
1529
        @"class Test
 
1530
{
 
1531
        Test TestMethod ()
 
1532
        {
 
1533
                try {
 
1534
                        ;
 
1535
                } catch (Exception e) {
 
1536
                }
 
1537
                finally {
 
1538
                }
 
1539
        }
 
1540
}");
 
1541
                }
 
1542
 
 
1543
                [Test]
 
1544
                public void TestPlaceWhileOnNewLine()
 
1545
                {
 
1546
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono();
 
1547
                        
 
1548
                        policy.WhileNewLinePlacement = NewLinePlacement.NewLine;
 
1549
                        
 
1550
                        Test (policy, @"class Test
 
1551
{
 
1552
        Test TestMethod ()
 
1553
        {
 
1554
                do {
 
1555
                        ;
 
1556
                } while (true);
 
1557
        }
 
1558
}",
 
1559
        @"class Test
 
1560
{
 
1561
        Test TestMethod ()
 
1562
        {
 
1563
                do {
 
1564
                        ;
 
1565
                }
 
1566
                while (true);
 
1567
        }
 
1568
}");
 
1569
                }
 
1570
 
 
1571
                [Test]
 
1572
                public void TestBlockStatementWithComments ()
 
1573
                {
 
1574
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1575
 
 
1576
                        Test (policy, @"class Test
 
1577
{
 
1578
        Test TestMethod ()
 
1579
        {
 
1580
{
 
1581
 //CMT1
 
1582
;
 
1583
 /* cmt 2 */
 
1584
}
 
1585
        }
 
1586
}", @"class Test
 
1587
{
 
1588
        Test TestMethod ()
 
1589
        {
 
1590
                {
 
1591
                        //CMT1
 
1592
                        ;
 
1593
                        /* cmt 2 */
 
1594
                }
 
1595
        }
 
1596
}");
 
1597
                }
 
1598
 
 
1599
                [Test]
 
1600
                public void TestBlockStatementWithPreProcessorDirective ()
 
1601
                {
 
1602
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
1603
 
 
1604
                        Test (policy, @"class Test
 
1605
{
 
1606
        Test TestMethod ()
 
1607
        {
 
1608
{
 
1609
" + @" #if true
 
1610
;
 
1611
" + @" #endif
 
1612
}
 
1613
        }
 
1614
}", @"class Test
 
1615
{
 
1616
        Test TestMethod ()
 
1617
        {
 
1618
                {
 
1619
" + @"                  #if true
 
1620
                        ;
 
1621
" + @"                  #endif
 
1622
                }
 
1623
        }
 
1624
}");
 
1625
                }
 
1626
 
 
1627
                [Test]
 
1628
                public void TestUsingInsideNamespace()
 
1629
                {
 
1630
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono();
 
1631
                        policy.UsingPlacement = UsingPlacement.InsideNamespace;
 
1632
 
 
1633
                        Test(policy, @"namespace TestNamespace
 
1634
{
 
1635
using System;
 
1636
 
 
1637
        class Test
 
1638
        {
 
1639
        }
 
1640
}", @"namespace TestNamespace
 
1641
{
 
1642
        using System;
 
1643
 
 
1644
        class Test
 
1645
        {
 
1646
        }
 
1647
}");
 
1648
                }
 
1649
                
 
1650
        }
 
1651
}