Skip to content

Commit 2a1108d

Browse files
committed
Formatted code
1 parent 36409a6 commit 2a1108d

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

src/NotebookUnit/RunTestsMagicCommand.cs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,43 @@
88

99
namespace NotebookUnit
1010
{
11-
public class RunTestsMagicCommand : IKernelExtension
12-
{
13-
public async Task OnLoadAsync(Kernel kernel)
14-
{
11+
public class RunTestsMagicCommand : IKernelExtension
12+
{
13+
public async Task OnLoadAsync(Kernel kernel)
14+
{
1515

16-
var testCommand = new Command("#!test", "Run the tests in this notebook")
17-
{
18-
new Option<Action[]>(new string[] {"-t", "--tests" }, () => new Action[] { }, "Specify tests to run")
19-
};
16+
var testCommand = new Command("#!test", "Run the tests in this notebook")
17+
{
18+
new Option<Action[]>(new string[] {"-t", "--tests" }, () => new Action[] { }, "Specify tests to run")
19+
};
2020

21-
testCommand.Handler =
22-
CommandHandler.Create(async (Action[] tests, KernelInvocationContext context) =>
23-
RunTests(tests, context));
21+
testCommand.Handler =
22+
CommandHandler.Create(async (Action[] tests, KernelInvocationContext context) =>
23+
RunTests(tests, context));
2424

25-
kernel.AddDirective(testCommand);
25+
kernel.AddDirective(testCommand);
2626

27-
if (KernelInvocationContext.Current is { } context)
28-
{
29-
await context.DisplayAsync($"`{nameof(RunTestsMagicCommand)}` is loaded. It enables testing in notebooks", "text/markdown");
30-
}
27+
if (KernelInvocationContext.Current is { } context)
28+
{
29+
await context.DisplayAsync($"`{nameof(RunTestsMagicCommand)}` is loaded. It enables testing in notebooks", "text/markdown");
30+
}
3131

32-
}
32+
}
3333

3434
private object RunTests(Action[] tests, KernelInvocationContext context)
3535
{
3636

37-
if (tests == null || tests.Length == 0) {
38-
context.Fail(message: "No tests");
39-
return null;
37+
if (tests == null || tests.Length == 0)
38+
{
39+
context.Fail(message: "No tests");
40+
return null;
4041
}
4142

42-
context.Publish(new DisplayedValueProduced("Tests to be run", context.Command, new[] {
43-
new FormattedValue(PlainTextFormatter.MimeType, "Tests will be run")
44-
}));
43+
context.Publish(new DisplayedValueProduced("Tests to be run", context.Command, new[] {
44+
new FormattedValue(PlainTextFormatter.MimeType, "Tests will be run")
45+
}));
4546

46-
return new object();
47+
return new object();
4748

4849
}
4950

0 commit comments

Comments
 (0)