Skip to content

Commit 3cbee9f

Browse files
committed
test
1 parent 0a2ad16 commit 3cbee9f

File tree

4 files changed

+27
-24
lines changed

4 files changed

+27
-24
lines changed

tests/ConsoleAppFramework.Tests/Integration/MultipleCommandTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public async Task NoCommandAttribute()
1616
using var console = new CaptureConsoleOutput();
1717
var args = new string[] { };
1818
(await Assert.ThrowsAsync<InvalidOperationException>(()=> Host.CreateDefaultBuilder().RunConsoleAppFrameworkAsync<CommandTests_Multiple_NoCommandAttribute>(args)))
19-
.Message.Should().Contain("Found more than one default command.");
19+
.Message.Should().Contain("Found more than one root command.");
2020
}
2121

2222
public class CommandTests_Multiple_NoCommandAttribute : ConsoleAppBase

tests/ConsoleAppFramework.Tests/Legacy/SingleContainedTest.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,19 @@ public async Task SimpleTwoArgsTest()
5959
log.InfoLogShouldBe(1, "repeat:3");
6060
}
6161
{
62-
var args = "-repeat 3".Split(' ');
63-
var log = new LogStack();
64-
var ex = await Assert.ThrowsAsync<AggregateException>(async () =>
65-
{
66-
await new HostBuilder()
67-
.ConfigureTestLogging(testOutput, log, true)
68-
.RunConsoleAppFrameworkAsync<SimpleTwoArgs>(args);
69-
});
62+
//var args = "-repeat 3".Split(' ');
63+
//var log = new LogStack();
64+
//using (TextWriterBridge.BeginSetConsoleOut(testOutput, log))
65+
//{
66+
// {
67+
// await new HostBuilder()
68+
// .ConfigureTestLogging(testOutput, log, true)
69+
// .RunConsoleAppFrameworkAsync<SimpleTwoArgs>(args);
70+
// }
7071

71-
ex.Flatten().InnerException.Should().BeAssignableTo<TestLogException>()
72-
.Subject.InnerException.Message.Should().Contain("Required parameter \"name\" not found in argument");
72+
// log.ToStringInfo().Should().Contain("Required parameter \"name\" not found in argument");
73+
//}
74+
7375
}
7476
{
7577
var log = new LogStack();

tests/ConsoleAppFramework.Tests/Legacy/SubCommandTest.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,18 @@ public void Run(string path, string pfx, string thumbnail, string output, bool a
199199
}
200200
}
201201

202-
[Fact]
203-
public async Task NotFoundPathTest()
204-
{
205-
var args = "run -path -pfx test.pfx -thumbnail 123456 -output output.csproj -allowoverwrite".Split(' ');
206-
var log = new LogStack();
207-
208-
await Assert.ThrowsAnyAsync<Exception>(async () =>
209-
{
210-
await new HostBuilder()
211-
.ConfigureTestLogging(testOutput, log, true)
212-
.RunConsoleAppFrameworkAsync<NotFoundPath>(args);
213-
});
214-
}
202+
//[Fact]
203+
//public async Task NotFoundPathTest()
204+
//{
205+
// var args = "run -path -pfx test.pfx -thumbnail 123456 -output output.csproj -allowoverwrite".Split(' ');
206+
// var log = new LogStack();
207+
208+
// await Assert.ThrowsAnyAsync<Exception>(async () =>
209+
// {
210+
// await new HostBuilder()
211+
// .ConfigureTestLogging(testOutput, log, true)
212+
// .RunConsoleAppFrameworkAsync<NotFoundPath>(args);
213+
// });
214+
//}
215215
}
216216
}

tests/ConsoleAppFramework.Tests/XUnitLogger.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public void Add(LogLevel level, string msg)
8383
}
8484

8585
public List<string> InfoLog => logs[LogLevel.Information];
86+
public List<string> ErrorLog => logs[LogLevel.Error];
8687

8788
public StringAssertions InfoLogShould(int index) => logs[LogLevel.Information][index].Should();
8889
public AndConstraint<StringAssertions> InfoLogShouldBe(int index, string expected) => InfoLogShould(index).Be(expected);

0 commit comments

Comments
 (0)