44
55using NUnit . Framework ;
66
7+ // ReSharper disable ClassNeverInstantiated.Local
8+ // ReSharper disable UnusedMember.Global
9+ // ReSharper disable MemberHidesStaticFromOuterClass
10+ // ReSharper disable UnusedMember.Local
11+ // ReSharper disable FieldCanBeMadeReadOnly.Local
12+ // ReSharper disable UnusedAutoPropertyAccessor.Local
13+ // ReSharper disable ReturnValueOfPureMethodIsNotUsed
14+ // ReSharper disable NotAccessedField.Local
15+
716#pragma warning disable 649
17+ #pragma warning disable 169
818
919namespace CodeJam . Mapping
1020{
@@ -13,7 +23,7 @@ namespace CodeJam.Mapping
1323 [ TestFixture ]
1424 public class MapperTests
1525 {
16- class MapHelper < TFrom , TTo >
26+ private class MapHelper < TFrom , TTo >
1727 where TFrom : new ( )
1828 where TTo : new ( )
1929 {
@@ -26,14 +36,7 @@ public MapHelper<TFrom,TTo> Map(bool action, TFrom fromObj, Func<MapperBuilder<T
2636
2737 From = fromObj ;
2838
29- if ( action )
30- {
31- To = mapper . Map ( From , new TTo ( ) ) ;
32- }
33- else
34- {
35- To = mapper . Map ( From ) ;
36- }
39+ To = action ? mapper . Map ( From , new TTo ( ) ) : mapper . Map ( From ) ;
3740
3841 return this ;
3942 }
@@ -42,7 +45,7 @@ public MapHelper<TFrom,TTo> Map(bool action, TFrom fromObj, Func<MapperBuilder<T
4245 public TTo To ;
4346 }
4447
45- class TestMap { }
48+ private class TestMap { }
4649
4750 [ Test ]
4851 public void ActionExpressionTest ( )
@@ -87,7 +90,7 @@ public void MapStringToInt()
8790 Assert . That ( dest , Is . EqualTo ( 42 ) ) ;
8891 }
8992
90- enum Gender
93+ private enum Gender
9194 {
9295 [ MapValue ( "F" ) ] Female ,
9396 [ MapValue ( "M" ) ] Male ,
@@ -113,23 +116,23 @@ public void MapStringToGender()
113116 Assert . That ( dest , Is . EqualTo ( Gender . Male ) ) ;
114117 }
115118
116- enum Enum1
119+ private enum Enum1
117120 {
118121 Value1 = 10 ,
119122 Value2 ,
120123 Value3 ,
121124 Value4 ,
122125 }
123126
124- enum Enum2
127+ private enum Enum2
125128 {
126129 Value1 ,
127130 Value2 = 10 ,
128131 Value3 ,
129132 Value4 ,
130133 }
131134
132- class Dest
135+ private class Dest
133136 {
134137 public int Field1 ;
135138 public float Field3 ;
@@ -148,7 +151,7 @@ class Dest
148151 public Enum2 Field17 ;
149152 }
150153
151- class Source
154+ private class Source
152155 {
153156 public int Field1 = 1 ;
154157 public int Field2 = 2 ;
@@ -318,10 +321,10 @@ public void MapFilterObjects([Values(true,false)] bool useAction)
318321 Assert . That ( map . To . Field7 , Is . Not . EqualTo ( map . From . Field7 ) ) ;
319322 }
320323
321- class Class1 { public int Field = 1 ; }
322- class Class2 { public int Field = 2 ; }
323- class Class3 { public Class1 Class = new Class1 ( ) ; }
324- class Class4 { public Class2 Class = new Class2 ( ) ; }
324+ private class Class1 { public int Field = 1 ; }
325+ private class Class2 { public int Field = 2 ; }
326+ private class Class3 { public Class1 Class = new Class1 ( ) ; }
327+ private class Class4 { public Class2 Class = new Class2 ( ) ; }
325328
326329 [ Test ]
327330 public void MapInnerObject1 ( [ Values ( true , false ) ] bool useAction )
@@ -331,8 +334,8 @@ public void MapInnerObject1([Values(true,false)] bool useAction)
331334 Assert . That ( map . To . Class . Field , Is . EqualTo ( map . From . Class . Field ) ) ;
332335 }
333336
334- class Class5 { public Class1 Class1 = new Class1 ( ) ; public Class1 Class2 ; }
335- class Class6 { public Class2 Class1 = new Class2 ( ) ; public Class2 Class2 = null ; }
337+ private class Class5 { public Class1 Class1 = new Class1 ( ) ; public Class1 Class2 ; }
338+ private class Class6 { public Class2 Class1 = new Class2 ( ) ; public Class2 Class2 = null ; }
336339
337340 [ Test ]
338341 public void MapInnerObject2 ( [ Values ( true , false ) ] bool useAction )
@@ -362,10 +365,10 @@ public void MapInnerObject3([Values(true,false)] bool useAction)
362365 Assert . That ( map . To . Class2 , Is . Not . SameAs ( map . To . Class1 ) ) ;
363366 }
364367
365- class Class7 { public Class9 Class ; }
366- class Class8 { public Class10 Class = null ; }
367- class Class9 { public Class7 Class = new Class7 ( ) ; }
368- class Class10 { public Class8 Class = new Class8 ( ) ; }
368+ private class Class7 { public Class9 Class ; }
369+ private class Class8 { public Class10 Class = null ; }
370+ private class Class9 { public Class7 Class = new Class7 ( ) ; }
371+ private class Class10 { public Class8 Class = new Class8 ( ) ; }
369372
370373 [ Test ]
371374 public void SelfReference1 ( [ Values ( true , false ) ] bool useAction )
@@ -380,8 +383,8 @@ public void SelfReference1([Values(true,false)] bool useAction)
380383 Assert . That ( map . To , Is . SameAs ( map . To . Class . Class ) ) ;
381384 }
382385
383- class Class11 { public Class9 Class = new Class9 ( ) ; }
384- class Class12 { public Class10 Class = new Class10 ( ) ; }
386+ private class Class11 { public Class9 Class = new Class9 ( ) ; }
387+ private class Class12 { public Class10 Class = new Class10 ( ) ; }
385388
386389 [ Test ]
387390 public void SelfReference2 ( [ Values ( true , false ) ] bool useAction )
@@ -396,20 +399,20 @@ public void SelfReference2([Values(true,false)] bool useAction)
396399 Assert . That ( map . To . Class , Is . SameAs ( map . To . Class . Class . Class ) ) ;
397400 }
398401
399- class Cl1 { }
400- class Cl2 { public Cl1 Class1 = new Cl1 ( ) ; }
401- class Cl3 { public Cl1 Class1 = new Cl1 ( ) ; }
402- class Cl4 { public Cl1 Class1 = new Cl1 ( ) ; public Cl2 Class2 = new Cl2 ( ) ; public Cl3 Class3 = new Cl3 ( ) ; }
403- class Cl21 { public Cl1 Class1 ; }
404- class Cl31 { public Cl1 Class1 ; }
405- class Cl41 { public Cl1 Class1 ; public Cl21 Class2 ; public Cl31 Class3 ; }
402+ private class Cl1 { }
403+ private class Cl2 { public Cl1 Class1 = new Cl1 ( ) ; }
404+ private class Cl3 { public Cl1 Class1 = new Cl1 ( ) ; }
405+ private class Cl4 { public Cl1 Class1 = new Cl1 ( ) ; public Cl2 Class2 = new Cl2 ( ) ; public Cl3 Class3 = new Cl3 ( ) ; }
406+ private class Cl21 { public Cl1 Class1 ; }
407+ private class Cl31 { public Cl1 Class1 ; }
408+ private class Cl41 { public Cl1 Class1 ; public Cl21 Class2 ; public Cl31 Class3 ; }
406409
407410 [ Test ]
408411 public void SelfReference3 ( [ Values ( true , false ) ] bool useAction )
409412 {
410413 var src = new Cl4 ( ) ;
411414
412- var map = new MapHelper < Cl4 , Cl41 > ( ) . Map ( useAction , src , m => m
415+ new MapHelper < Cl4 , Cl41 > ( ) . Map ( useAction , src , m => m
413416 . SetProcessCrossReferences ( true ) ) ;
414417 }
415418
@@ -424,8 +427,8 @@ public void NullTest([Values(true,false)] bool useAction)
424427 Assert . That ( map . To . Class2 , Is . Null ) ;
425428 }
426429
427- class Class13 { public Class1 Class = new Class1 ( ) ; }
428- class Class14 { public Class1 Class = new Class1 ( ) ; }
430+ private class Class13 { public Class1 Class = new Class1 ( ) ; }
431+ private class Class14 { public Class1 Class = new Class1 ( ) ; }
429432
430433 [ Test ]
431434 public void DeepCopy1 ( [ Values ( true , false ) ] bool useAction )
@@ -448,8 +451,8 @@ public void DeepCopy2([Values(true,false)] bool useAction)
448451 Assert . That ( map . To . Class , Is . SameAs ( src . Class ) ) ;
449452 }
450453
451- class Class15 { public List < Class1 > List = new List < Class1 > { new Class1 ( ) , new Class1 ( ) } ; }
452- class Class16 { public List < Class2 > List = null ; }
454+ private class Class15 { public List < Class1 > List = new List < Class1 > { new Class1 ( ) , new Class1 ( ) } ; }
455+ private class Class16 { public List < Class2 > List = null ; }
453456
454457 [ Test ]
455458 public void ObjectList ( [ Values ( true , false ) ] bool useAction )
@@ -503,11 +506,11 @@ public void ScalarArray()
503506 Assert . AreEqual ( "3" , dest [ 2 ] ) ;
504507 }
505508
506- class Class17
509+ private class Class17
507510 {
508511 public IEnumerable < Class9 > Arr => GetEnumerable ( ) ;
509512
510- static IEnumerable < Class9 > GetEnumerable ( )
513+ private static IEnumerable < Class9 > GetEnumerable ( )
511514 {
512515 var c = new Class9 ( ) ;
513516
@@ -517,7 +520,7 @@ static IEnumerable<Class9> GetEnumerable()
517520 }
518521 }
519522
520- class Class18 { public Class9 [ ] Arr = null ; }
523+ private class Class18 { public Class9 [ ] Arr = null ; }
521524
522525 [ Test ]
523526 public void ObjectArray1 ( [ Values ( true , false ) ] bool useAction )
@@ -533,7 +536,7 @@ public void ObjectArray1([Values(true,false)] bool useAction)
533536 Assert . That ( mapper . To . Arr [ 0 ] , Is . SameAs ( mapper . To . Arr [ 2 ] ) ) ;
534537 }
535538
536- class Class19
539+ private class Class19
537540 {
538541 public Class9 [ ] Arr => new Class17 ( ) . Arr . ToArray ( ) ;
539542 }
@@ -552,8 +555,8 @@ public void ObjectArray2([Values(true,false)] bool useAction)
552555 Assert . That ( mapper . To . Arr [ 0 ] , Is . SameAs ( mapper . To . Arr [ 2 ] ) ) ;
553556 }
554557
555- class Class20 { public Source Class1 = new Source ( ) ; public Source Class2 ; }
556- class Class21 { public Dest Class1 = null ; public Dest Class2 = null ; }
558+ private class Class20 { public Source Class1 = new Source ( ) ; public Source Class2 ; }
559+ private class Class21 { public Dest Class1 = null ; public Dest Class2 = null ; }
557560
558561 [ Test ]
559562 public void NoCrossRef ( [ Values ( true , false ) ] bool useAction )
@@ -571,7 +574,7 @@ public void NoCrossRef([Values(true,false)] bool useAction)
571574 Assert . That ( mapper . To . Class1 , Is . Not . SameAs ( mapper . To . Class2 ) ) ;
572575 }
573576
574- public class Object3
577+ private class Object3
575578 {
576579 public HashSet < string > HashSet = new HashSet < string > ( StringComparer . InvariantCultureIgnoreCase ) ;
577580 }
@@ -593,8 +596,9 @@ public void CollectionTest([Values(true,false)] bool useAction)
593596 }
594597 }
595598
596- class RTest1
597- { public List < RTest1 > Depends { get ; set ; }
599+ private class RTest1
600+ {
601+ public List < RTest1 > Depends { get ; set ; }
598602 }
599603
600604 [ Test ]
@@ -618,7 +622,7 @@ public void RecursionTest2([Values(true,false)] bool useAction)
618622 Assert . That ( mapper . To , Is . Not . Null ) ;
619623 }
620624
621- public class ByteTestClass
625+ private class ByteTestClass
622626 {
623627 public byte [ ] Image { get ; set ; }
624628 }
@@ -631,17 +635,17 @@ public void ByteArrayTest([Values(true,false)] bool useAction)
631635 Assert . That ( mapper . To , Is . Not . Null ) ;
632636 }
633637
634- class RClass1
638+ private class RClass1
635639 {
636640 public RClass2 Class2 ;
637641 }
638642
639- class RClass2
643+ private class RClass2
640644 {
641645 public List < RClass3 > List ;
642646 }
643647
644- class RClass3
648+ private class RClass3
645649 {
646650 public RClass1 Class1 ;
647651 public RClass2 Class2 ;
0 commit comments