Skip to content

Commit

Permalink
Factory methods writer -- params for SwitchCase
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitz committed May 30, 2019
1 parent a9be5bf commit ee3bad0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 45 deletions.
3 changes: 2 additions & 1 deletion Shared/FactoryMethodsFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ protected override void WriteBinding(MemberBinding binding) {
}
}

protected override void WriteSwitchCase(SwitchCase switchCase) => WriteMethodCall(() => SwitchCase(switchCase.Body, switchCase.TestValues));
protected override void WriteSwitchCase(SwitchCase switchCase) =>
WriteMethodCall(() => SwitchCase(switchCase.Body, switchCase.TestValues.ToArray()));

protected override void WriteCatchBlock(CatchBlock catchBlock) {
if (catchBlock.Variable != null) {
Expand Down
60 changes: 16 additions & 44 deletions Tests.Common/Constructed/MakeSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public void SingleValueSwitchCase() => RunTest(
Constant(true)
)
),
new[] {
Constant(5)
}
Constant(5)
)"

);
Expand Down Expand Up @@ -69,10 +67,8 @@ public void MultiValueSwitchCase() => RunTest(
Constant(true)
)
),
new[] {
Constant(5),
Constant(6)
}
Constant(5),
Constant(6)
)"
);

Expand All @@ -90,9 +86,7 @@ public void SingleValueSwitchCase1() => RunTest(
typeof(Console).GetMethod(""WriteLine""),
Constant(true)
),
new[] {
Constant(5)
}
Constant(5)
)"
);

Expand All @@ -111,10 +105,8 @@ public void MultiValueSwitchCase1() => RunTest(
typeof(Console).GetMethod(""WriteLine""),
Constant(true)
),
new[] {
Constant(5),
Constant(6)
}
Constant(5),
Constant(6)
)"
);

Expand Down Expand Up @@ -153,18 +145,14 @@ Case Else
typeof(Console).GetMethod(""WriteLine""),
Constant(true)
),
new[] {
Constant(4)
}
Constant(4)
),
SwitchCase(
Call(
typeof(Console).GetMethod(""WriteLine""),
Constant(false)
),
new[] {
Constant(5)
}
Constant(5)
)
)"
);
Expand Down Expand Up @@ -214,18 +202,14 @@ Case Else
typeof(Console).GetMethod(""WriteLine""),
Constant(true)
),
new[] {
Constant(4)
}
Constant(4)
),
SwitchCase(
Call(
typeof(Console).GetMethod(""WriteLine""),
Constant(false)
),
new[] {
Constant(5)
}
Constant(5)
)
)"
);
Expand Down Expand Up @@ -282,18 +266,14 @@ Case Else
typeof(Console).GetMethod(""WriteLine""),
Constant(true)
),
new[] {
Constant(4)
}
Constant(4)
),
SwitchCase(
Call(
typeof(Console).GetMethod(""WriteLine""),
Constant(false)
),
new[] {
Constant(5)
}
Constant(5)
)
)"
);
Expand Down Expand Up @@ -328,18 +308,14 @@ Case 5
typeof(Console).GetMethod(""WriteLine""),
Constant(true)
),
new[] {
Constant(4)
}
Constant(4)
),
SwitchCase(
Call(
typeof(Console).GetMethod(""WriteLine""),
Constant(false)
),
new[] {
Constant(5)
}
Constant(5)
)
)"
);
Expand Down Expand Up @@ -381,18 +357,14 @@ Case 5
typeof(Console).GetMethod(""WriteLine""),
Constant(true)
),
new[] {
Constant(4)
}
Constant(4)
),
SwitchCase(
Call(
typeof(Console).GetMethod(""WriteLine""),
Constant(false)
),
new[] {
Constant(5)
}
Constant(5)
)
)"
);
Expand Down

0 comments on commit ee3bad0

Please sign in to comment.