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

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.Tests/FormattingTests/TestWrapping.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
// TestWrapping.cs
 
3
//  
 
4
// Author:
 
5
//       Mike KrĆ¼ger <mkrueger@xamarin.com>
 
6
// 
 
7
// Copyright (c) 2012 Xamarin Inc. (http://xamarin.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 TestWrapping : TestBase
 
36
        {
 
37
                [Test]
 
38
                public void TestInitializerWrapAlways()
 
39
                {
 
40
                        var policy = FormattingOptionsFactory.CreateMono();
 
41
                        policy.ArrayInitializerWrapping = Wrapping.WrapAlways;
 
42
                        
 
43
                        Test(policy, @"class Test
 
44
{
 
45
        void TestMe ()
 
46
        {
 
47
                var foo = new [] { 1, 2, 3 };
 
48
        }
 
49
}",
 
50
@"class Test
 
51
{
 
52
        void TestMe ()
 
53
        {
 
54
                var foo = new [] {
 
55
                        1,
 
56
                        2,
 
57
                        3
 
58
                };
 
59
        }
 
60
}");
 
61
                }
 
62
 
 
63
                [Test]
 
64
                public void TestInitializerDoNotWrap()
 
65
                {
 
66
                        var policy = FormattingOptionsFactory.CreateMono();
 
67
                        policy.ArrayInitializerWrapping = Wrapping.DoNotWrap;
 
68
 
 
69
                        Test(policy,
 
70
@"class Test
 
71
{
 
72
        void TestMe ()
 
73
        {
 
74
                var foo = new [] {
 
75
                        1,
 
76
                        2,
 
77
                        3
 
78
                };
 
79
        }
 
80
}", @"class Test
 
81
{
 
82
        void TestMe ()
 
83
        {
 
84
                var foo = new [] { 1, 2, 3 };
 
85
        }
 
86
}");
 
87
                }
 
88
 
 
89
                [Test]
 
90
                public void TestInitializerBraceStyle()
 
91
                {
 
92
                        var policy = FormattingOptionsFactory.CreateMono();
 
93
                        policy.ArrayInitializerWrapping = Wrapping.WrapAlways;
 
94
                        policy.ArrayInitializerBraceStyle = BraceStyle.NextLine;
 
95
                        
 
96
                        Test(policy, @"class Test
 
97
{
 
98
        void TestMe ()
 
99
        {
 
100
                var foo = new [] {
 
101
                        1,
 
102
                        2,
 
103
                        3
 
104
                };
 
105
        }
 
106
}",
 
107
@"class Test
 
108
{
 
109
        void TestMe ()
 
110
        {
 
111
                var foo = new []
 
112
                {
 
113
                        1,
 
114
                        2,
 
115
                        3
 
116
                };
 
117
        }
 
118
}");
 
119
                }
 
120
 
 
121
                [Test]
 
122
                public void TestChainedMethodCallWrapping()
 
123
                {
 
124
                        var policy = FormattingOptionsFactory.CreateMono();
 
125
                        policy.ChainedMethodCallWrapping = Wrapping.WrapAlways;
 
126
                        
 
127
                        Test(policy, @"class Test
 
128
{
 
129
        void TestMe ()
 
130
        {
 
131
                Foo ().Bar ().             Zoom();
 
132
        }
 
133
}",
 
134
@"class Test
 
135
{
 
136
        void TestMe ()
 
137
        {
 
138
                Foo ()
 
139
                        .Bar ()
 
140
                        .Zoom ();
 
141
        }
 
142
}");
 
143
                }
 
144
 
 
145
                [Test]
 
146
                public void TestChainedMethodCallDoNotWrapWrapping()
 
147
                {
 
148
                        var policy = FormattingOptionsFactory.CreateMono();
 
149
                        policy.ChainedMethodCallWrapping = Wrapping.DoNotWrap;
 
150
                        
 
151
                        Test(policy, @"class Test
 
152
{
 
153
        void TestMe ()
 
154
        {
 
155
                Foo ()
 
156
                        .Bar ()
 
157
                        .Zoom ();
 
158
        }
 
159
}",
 
160
@"class Test
 
161
{
 
162
        void TestMe ()
 
163
        {
 
164
                Foo ().Bar ().Zoom ();
 
165
        }
 
166
}");
 
167
                }
 
168
 
 
169
                [Test]
 
170
                public void TestMethodCallArgumentWrapping()
 
171
                {
 
172
                        var policy = FormattingOptionsFactory.CreateMono();
 
173
                        policy.MethodCallArgumentWrapping = Wrapping.WrapAlways;
 
174
                        policy.NewLineAferMethodCallOpenParentheses = NewLinePlacement.NewLine;
 
175
                        policy.MethodCallClosingParenthesesOnNewLine = NewLinePlacement.NewLine;
 
176
 
 
177
                        Test(policy, @"class Test
 
178
{
 
179
        void TestMe ()
 
180
        {
 
181
                Foo (1, 2, 3);
 
182
        }
 
183
}",
 
184
@"class Test
 
185
{
 
186
        void TestMe ()
 
187
        {
 
188
                Foo (
 
189
                        1,
 
190
                        2,
 
191
                        3
 
192
                );
 
193
        }
 
194
}");
 
195
                }
 
196
 
 
197
                [Test]
 
198
                public void TestMethodCallArgumentNoNewLineWrapping()
 
199
                {
 
200
                        var policy = FormattingOptionsFactory.CreateMono();
 
201
                        policy.MethodCallArgumentWrapping = Wrapping.WrapAlways;
 
202
                        policy.NewLineAferMethodCallOpenParentheses = NewLinePlacement.SameLine;
 
203
                        policy.MethodCallClosingParenthesesOnNewLine = NewLinePlacement.SameLine;
 
204
 
 
205
                        Test(policy, @"class Test
 
206
{
 
207
        void TestMe ()
 
208
        {
 
209
                FooBar (1, 2, 3);
 
210
        }
 
211
}",
 
212
@"class Test
 
213
{
 
214
        void TestMe ()
 
215
        {
 
216
                FooBar (1,
 
217
                        2,
 
218
                        3);
 
219
        }
 
220
}");
 
221
                }
 
222
 
 
223
 
 
224
                [Test]
 
225
                public void TestMethodCallArgumentDoNotWrapWrapping()
 
226
                {
 
227
                        var policy = FormattingOptionsFactory.CreateMono();
 
228
                        policy.MethodCallArgumentWrapping = Wrapping.DoNotWrap;
 
229
                        policy.NewLineAferMethodCallOpenParentheses = NewLinePlacement.NewLine;
 
230
                        policy.MethodCallClosingParenthesesOnNewLine = NewLinePlacement.NewLine;
 
231
 
 
232
                        Test(policy, @"class Test
 
233
{
 
234
        void TestMe ()
 
235
        {
 
236
                Foo (
 
237
                        1, 
 
238
                        2, 
 
239
                        3
 
240
                );
 
241
        }
 
242
}",
 
243
@"class Test
 
244
{
 
245
        void TestMe ()
 
246
        {
 
247
                Foo (1, 2, 3);
 
248
        }
 
249
}");
 
250
                }
 
251
 
 
252
                
 
253
                [Test]
 
254
                public void TestIndexerCallArgumentNoNewLineWrapping()
 
255
                {
 
256
                        var policy = FormattingOptionsFactory.CreateMono();
 
257
                        policy.IndexerArgumentWrapping = Wrapping.WrapAlways;
 
258
                        policy.NewLineAferIndexerOpenBracket = NewLinePlacement.NewLine;
 
259
                        policy.IndexerClosingBracketOnNewLine = NewLinePlacement.NewLine;
 
260
 
 
261
                        Test(policy, @"class Test
 
262
{
 
263
        void TestMe ()
 
264
        {
 
265
                FooBar [1, 2, 3] = 5;
 
266
        }
 
267
}",
 
268
@"class Test
 
269
{
 
270
        void TestMe ()
 
271
        {
 
272
                FooBar [
 
273
                        1,
 
274
                        2,
 
275
                        3
 
276
                ] = 5;
 
277
        }
 
278
}");
 
279
                }
 
280
 
 
281
                [Test]
 
282
                public void TestObjectCreationArgumentNoNewLineWrapping()
 
283
                {
 
284
                        var policy = FormattingOptionsFactory.CreateMono();
 
285
                        policy.MethodCallArgumentWrapping = Wrapping.WrapAlways;
 
286
                        policy.NewLineAferMethodCallOpenParentheses = NewLinePlacement.NewLine;
 
287
                        policy.MethodCallClosingParenthesesOnNewLine = NewLinePlacement.NewLine;
 
288
 
 
289
                        Test(policy, @"class Test
 
290
{
 
291
        void TestMe ()
 
292
        {
 
293
                new FooBar (1, 2, 3);
 
294
        }
 
295
}",
 
296
@"class Test
 
297
{
 
298
        void TestMe ()
 
299
        {
 
300
                new FooBar (
 
301
                        1,
 
302
                        2,
 
303
                        3
 
304
                );
 
305
        }
 
306
}");
 
307
                }
 
308
 
 
309
                [Test]
 
310
                public void TestMethodDeclarationParameterNewLineWrapping()
 
311
                {
 
312
                        var policy = FormattingOptionsFactory.CreateMono();
 
313
                        policy.MethodDeclarationParameterWrapping = Wrapping.WrapAlways;
 
314
                        policy.NewLineAferMethodDeclarationOpenParentheses = NewLinePlacement.NewLine;
 
315
                        policy.MethodDeclarationClosingParenthesesOnNewLine = NewLinePlacement.NewLine;
 
316
 
 
317
                        Test(policy, @"class Test
 
318
{
 
319
        void TestMe (int i, int j, int k)
 
320
        {
 
321
        }
 
322
}",
 
323
@"class Test
 
324
{
 
325
        void TestMe (
 
326
                int i,
 
327
                int j,
 
328
                int k
 
329
        )
 
330
        {
 
331
        }
 
332
}");
 
333
                }
 
334
 
 
335
                [Test]
 
336
                public void TestMethodDeclarationParameterDoNotChangeCase1()
 
337
                {
 
338
                        var policy = FormattingOptionsFactory.CreateMono();
 
339
                        policy.MethodDeclarationParameterWrapping = Wrapping.DoNotChange;
 
340
 
 
341
                        Test(policy, @"class Test
 
342
{
 
343
        void TestMe (
 
344
                int i,
 
345
                int j,
 
346
                int k
 
347
                        )
 
348
        {
 
349
        }
 
350
}",
 
351
@"class Test
 
352
{
 
353
        void TestMe (
 
354
                int i,
 
355
                int j,
 
356
                int k
 
357
        )
 
358
        {
 
359
        }
 
360
}");
 
361
                }
 
362
 
 
363
                [Test]
 
364
                public void TestMethodDeclarationParameterDoNotChangeCase2()
 
365
                {
 
366
                        var policy = FormattingOptionsFactory.CreateMono();
 
367
                        policy.MethodDeclarationParameterWrapping = Wrapping.DoNotChange;
 
368
 
 
369
                        Test(policy, @"class Test
 
370
{
 
371
        void TestMe (
 
372
                int i,
 
373
                int j,
 
374
                int k                                           )
 
375
        {
 
376
        }
 
377
}",
 
378
@"class Test
 
379
{
 
380
        void TestMe (
 
381
                int i,
 
382
                int j,
 
383
                int k)
 
384
        {
 
385
        }
 
386
}");
 
387
                }
 
388
 
 
389
                [Test]
 
390
                public void TestMethodDeclarationParameterDoNotChangeCase3()
 
391
                {
 
392
                        var policy = FormattingOptionsFactory.CreateMono();
 
393
                        policy.MethodDeclarationParameterWrapping = Wrapping.DoNotChange;
 
394
 
 
395
                        Test(policy, @"class Test
 
396
{
 
397
        void TestMe (int i,
 
398
                     int j,
 
399
                     int k                                              )
 
400
        {
 
401
        }
 
402
}",
 
403
@"class Test
 
404
{
 
405
        void TestMe (int i,
 
406
                     int j,
 
407
                     int k)
 
408
        {
 
409
        }
 
410
}");
 
411
                }
 
412
 
 
413
                [Test]
 
414
                public void TestOperatorDeclarationParameterNewLineWrapping()
 
415
                {
 
416
                        var policy = FormattingOptionsFactory.CreateMono();
 
417
                        policy.MethodDeclarationParameterWrapping = Wrapping.WrapAlways;
 
418
                        policy.NewLineAferMethodDeclarationOpenParentheses = NewLinePlacement.NewLine;
 
419
                        policy.MethodDeclarationClosingParenthesesOnNewLine = NewLinePlacement.SameLine;
 
420
 
 
421
                        Test(policy, @"class Test
 
422
{
 
423
        public static Test operator + (Test a, Test b)
 
424
        {
 
425
                return null;
 
426
        }
 
427
}",
 
428
@"class Test
 
429
{
 
430
        public static Test operator + (
 
431
                Test a,
 
432
                Test b)
 
433
        {
 
434
                return null;
 
435
        }
 
436
}");
 
437
                }
 
438
 
 
439
                [Test]
 
440
                public void TestConstructorDeclarationParameterNewLineWrapping()
 
441
                {
 
442
                        var policy = FormattingOptionsFactory.CreateMono();
 
443
                        policy.MethodDeclarationParameterWrapping = Wrapping.WrapAlways;
 
444
                        policy.NewLineAferMethodDeclarationOpenParentheses = NewLinePlacement.NewLine;
 
445
                        policy.MethodDeclarationClosingParenthesesOnNewLine = NewLinePlacement.NewLine;
 
446
 
 
447
                        Test(policy, @"class Test
 
448
{
 
449
        Test (int i, int j, int k)
 
450
        {
 
451
        }
 
452
}",
 
453
@"class Test
 
454
{
 
455
        Test (
 
456
                int i,
 
457
                int j,
 
458
                int k
 
459
        )
 
460
        {
 
461
        }
 
462
}");
 
463
                }
 
464
 
 
465
                [Test]
 
466
                public void TestIndexerDeclarationParameterNewLineWrapping()
 
467
                {
 
468
                        var policy = FormattingOptionsFactory.CreateMono();
 
469
                        policy.IndexerDeclarationParameterWrapping = Wrapping.WrapAlways;
 
470
                        policy.NewLineAferIndexerDeclarationOpenBracket = NewLinePlacement.NewLine;
 
471
                        policy.IndexerDeclarationClosingBracketOnNewLine = NewLinePlacement.NewLine;
 
472
                        Test(policy, @"class Test
 
473
{
 
474
        int this [int i, int j, int k] {
 
475
                get {
 
476
                }
 
477
        }
 
478
}",
 
479
                             @"class Test
 
480
{
 
481
        int this [
 
482
                int i,
 
483
                int j,
 
484
                int k
 
485
        ] {
 
486
                get {
 
487
                }
 
488
        }
 
489
}");
 
490
                }
 
491
 
 
492
                [Test]
 
493
                public void TestIndexerDeclarationAlignment()
 
494
                {
 
495
                        var policy = FormattingOptionsFactory.CreateMono();
 
496
                        policy.AlignToFirstIndexerDeclarationParameter = true;
 
497
                        Test(policy, @"class Test
 
498
{
 
499
        int this [int i,
 
500
int j,
 
501
 int k] {
 
502
                get {
 
503
                }
 
504
        }
 
505
}",
 
506
                             @"class Test
 
507
{
 
508
        int this [int i,
 
509
                  int j,
 
510
                  int k] {
 
511
                get {
 
512
                }
 
513
        }
 
514
}");
 
515
                }
 
516
 
 
517
                [Test]
 
518
                public void TestMethodCallArgumentWrappingDoNotChangeCase1()
 
519
                {
 
520
                        var policy = FormattingOptionsFactory.CreateMono();
 
521
                        policy.MethodCallArgumentWrapping = Wrapping.DoNotChange;
 
522
                        policy.NewLineAferMethodCallOpenParentheses = NewLinePlacement.NewLine;
 
523
                        policy.MethodCallClosingParenthesesOnNewLine = NewLinePlacement.NewLine;
 
524
 
 
525
                        Test(policy, @"class Test
 
526
{
 
527
        void TestMe ()
 
528
        {
 
529
                Foo (
 
530
                        1,
 
531
                        2,
 
532
                        3
 
533
                );
 
534
        }
 
535
}",
 
536
@"class Test
 
537
{
 
538
        void TestMe ()
 
539
        {
 
540
                Foo (
 
541
                        1,
 
542
                        2,
 
543
                        3
 
544
                );
 
545
        }
 
546
}");
 
547
                }
 
548
 
 
549
                [Test]
 
550
                public void TestMethodCallArgumentWrappingDoNotChangeCase2()
 
551
                {
 
552
                        var policy = FormattingOptionsFactory.CreateMono();
 
553
                        policy.MethodCallArgumentWrapping = Wrapping.DoNotChange;
 
554
                        policy.NewLineAferMethodCallOpenParentheses = NewLinePlacement.NewLine;
 
555
                        policy.MethodCallClosingParenthesesOnNewLine = NewLinePlacement.NewLine;
 
556
 
 
557
                        Test(policy, @"class Test
 
558
{
 
559
        void TestMe ()
 
560
        {
 
561
                Foo (1,
 
562
                     2,
 
563
                     3
 
564
                                        );
 
565
        }
 
566
}",
 
567
@"class Test
 
568
{
 
569
        void TestMe ()
 
570
        {
 
571
                Foo (1,
 
572
                     2,
 
573
                     3
 
574
                );
 
575
        }
 
576
}");
 
577
                }
 
578
 
 
579
                [Test]
 
580
                public void TestMethodCallArgumentWrappingDoNotChangeCase3()
 
581
                {
 
582
                        var policy = FormattingOptionsFactory.CreateMono();
 
583
                        policy.MethodCallArgumentWrapping = Wrapping.DoNotChange;
 
584
                        policy.NewLineAferMethodCallOpenParentheses = NewLinePlacement.NewLine;
 
585
                        policy.MethodCallClosingParenthesesOnNewLine = NewLinePlacement.NewLine;
 
586
 
 
587
                        Test(policy, @"class Test
 
588
{
 
589
        void TestMe ()
 
590
        {
 
591
                Foo (1,
 
592
                     2,
 
593
                     3           );
 
594
        }
 
595
}",
 
596
@"class Test
 
597
{
 
598
        void TestMe ()
 
599
        {
 
600
                Foo (1,
 
601
                     2,
 
602
                     3);
 
603
        }
 
604
}");
 
605
                }
 
606
 
 
607
                [Test]
 
608
                public void TestDoNotTouchMethodDeclarationCase1 ()
 
609
                {
 
610
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
611
 
 
612
                        var adapter = Test (policy, @"class Test
 
613
{
 
614
        int Foo (int i, double d, Action a)
 
615
        {
 
616
                a ();
 
617
        }
 
618
}",
 
619
                                            @"class Test
 
620
{
 
621
        int Foo (int i, double d, Action a)
 
622
        {
 
623
                a ();
 
624
        }
 
625
}", FormattingMode.Intrusive);
 
626
                }
 
627
 
 
628
                [Test]
 
629
                public void TestNoBlankLinesBetweenEndBraceAndEndParenthesis ()
 
630
                {
 
631
                        CSharpFormattingOptions policy = FormattingOptionsFactory.CreateMono ();
 
632
                        policy.BlankLinesBetweenMembers = 1;
 
633
 
 
634
                        var adapter = Test (policy, @"class Test
 
635
{
 
636
        int Foo (int i, double d, Action a)
 
637
        {
 
638
                a ();
 
639
        }
 
640
 
 
641
        void Bar ()
 
642
        {
 
643
                Foo (1, 2, () => {
 
644
                });
 
645
        }
 
646
}",
 
647
                                            @"class Test
 
648
{
 
649
        int Foo (int i, double d, Action a)
 
650
        {
 
651
                a ();
 
652
        }
 
653
 
 
654
        void Bar ()
 
655
        {
 
656
                Foo (1, 2, () => {
 
657
                });
 
658
        }
 
659
}", FormattingMode.Intrusive);
 
660
                }
 
661
 
 
662
                [Test]
 
663
                public void TestMethodCallDoNotWrapCorrectionNoAlignment()
 
664
                {
 
665
                        var policy = FormattingOptionsFactory.CreateMono();
 
666
                        policy.MethodCallArgumentWrapping = Wrapping.DoNotChange;
 
667
                        policy.NewLineAferMethodCallOpenParentheses = NewLinePlacement.DoNotCare;
 
668
                        policy.MethodCallClosingParenthesesOnNewLine = NewLinePlacement.DoNotCare;
 
669
                        policy.AlignToFirstMethodCallArgument = false;
 
670
                        Test(policy, @"class Test
 
671
{
 
672
        void TestMe ()
 
673
        {
 
674
                FooBarLongMethod (1,
 
675
        2,
 
676
3
 
677
                                );
 
678
        }
 
679
}",
 
680
                             @"class Test
 
681
{
 
682
        void TestMe ()
 
683
        {
 
684
                FooBarLongMethod (1,
 
685
                        2,
 
686
                        3
 
687
                );
 
688
        }
 
689
}");
 
690
                }
 
691
 
 
692
 
 
693
                [Test]
 
694
                public void TestMethodCallNoAlignmentHasNoEffectInNewLineCase()
 
695
                {
 
696
                        var policy = FormattingOptionsFactory.CreateMono();
 
697
                        policy.MethodCallArgumentWrapping = Wrapping.DoNotChange;
 
698
                        policy.AlignToFirstMethodCallArgument = true;
 
699
                        Test(policy, @"class Test
 
700
{
 
701
        void TestMe ()
 
702
        {
 
703
                FooBarLongMethod (
 
704
1,
 
705
        2,
 
706
3
 
707
                                );
 
708
        }
 
709
}",
 
710
                             @"class Test
 
711
{
 
712
        void TestMe ()
 
713
        {
 
714
                FooBarLongMethod (
 
715
                        1,
 
716
                        2,
 
717
                        3
 
718
                );
 
719
        }
 
720
}");
 
721
                }
 
722
 
 
723
                [Test]
 
724
                public void TestMethodDeclarationNoAlignmentHasNoEffectInNewLineCase()
 
725
                {
 
726
                        var policy = FormattingOptionsFactory.CreateMono();
 
727
                        policy.MethodCallArgumentWrapping = Wrapping.DoNotChange;
 
728
                        policy.AlignToFirstMethodDeclarationParameter = true;
 
729
                        Test(policy, @"class Test
 
730
{
 
731
        void TestMe (
 
732
int test,
 
733
string fooo)
 
734
        {
 
735
        }
 
736
}",
 
737
                             @"class Test
 
738
{
 
739
        void TestMe (
 
740
                int test,
 
741
                string fooo)
 
742
        {
 
743
        }
 
744
}");
 
745
                }
 
746
 
 
747
                [Test]
 
748
                public void TestMethodDeclarationAlignment()
 
749
                {
 
750
                        var policy = FormattingOptionsFactory.CreateMono();
 
751
                        policy.AlignToFirstMethodDeclarationParameter = true;
 
752
                        Test(policy, @"class Test
 
753
{
 
754
        void TestMe (int test,
 
755
string fooo)
 
756
        {
 
757
        }
 
758
}",
 
759
                             @"class Test
 
760
{
 
761
        void TestMe (int test,
 
762
                     string fooo)
 
763
        {
 
764
        }
 
765
}");
 
766
                }
 
767
 
 
768
                [Test]
 
769
                public void TestMethodDeclarationNoAlignmentHasNoEffectInNewLine2()
 
770
                {
 
771
                        var policy = FormattingOptionsFactory.CreateMono();
 
772
                        policy.MethodDeclarationParameterWrapping = Wrapping.WrapAlways;
 
773
                        policy.AlignToFirstMethodDeclarationParameter = false;
 
774
                        Test(policy, @"class Test
 
775
{
 
776
        public void LongMethodCallInMultiple (
 
777
int test,string foo,double bar)
 
778
        {
 
779
        }
 
780
}",
 
781
                             @"class Test
 
782
{
 
783
        public void LongMethodCallInMultiple (
 
784
                int test,
 
785
                string foo,
 
786
                double bar)
 
787
        {
 
788
        }
 
789
}");
 
790
                }
 
791
 
 
792
                [Test]
 
793
                public void TestMethodDeclarationDoNotWrapCorrectionNoAlignment()
 
794
                {
 
795
                        var policy = FormattingOptionsFactory.CreateMono();
 
796
                        policy.MethodDeclarationParameterWrapping = Wrapping.DoNotChange;
 
797
                        policy.NewLineAferMethodDeclarationOpenParentheses = NewLinePlacement.DoNotCare;
 
798
                        policy.MethodDeclarationClosingParenthesesOnNewLine = NewLinePlacement.DoNotCare;
 
799
                        policy.AlignToFirstMethodDeclarationParameter = false;
 
800
                        Test(policy, @"class Test
 
801
{
 
802
        void TestMe (int bar,
 
803
int test,
 
804
int foo)
 
805
        {
 
806
        }
 
807
}",
 
808
                             @"class Test
 
809
{
 
810
        void TestMe (int bar,
 
811
                int test,
 
812
                int foo)
 
813
        {
 
814
        }
 
815
}");
 
816
                }
 
817
        }
 
818
}