You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I create a project using CommandLineUtils
and I use ShellProgressBar for my command ,when I use dotnet tool command,the ShellProgressBar works well.
But there are some bugs in my project,I want to fix them by UnitTest
then,I test my command like this
[Fact]publicvoidDownloadFileFromFtp(){varcontent=newCommandLineApplication<DownloadFtp>();varservices=new ServiceCollection().AddLogging().AddSingleton(Program.Configuration).AddSingleton(Program.Configuration.Get<APPConfig>()).BuildServiceProvider();
content.Conventions
.UseDefaultConventions().UseConstructorInjection(services);
content.Parse();varresult= content.Execute(@"--path=/CUSTDB/1901-0048.rar","--taskid=1907-7777");//run the command
result.Should().Be(0);}
and then I will get System.IO.IOException: 句柄无效 error
the Stack Trace like this
Having similar issues, but differant stack trace when running an NUnit test:
System.IO.IOException : The handle is invalid.
at System.ConsolePal.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
at System.ConsolePal.GetCursorPosition()
at System.Console.get_CursorTop()
at ShellProgressBar.ProgressBar..ctor(Int32 maxTicks, String message, ProgressBarOptions options)```
I create a project using CommandLineUtils
and I use
ShellProgressBar
for my command ,when I usedotnet tool
command,theShellProgressBar
works well.But there are some bugs in my project,I want to fix them by
UnitTest
then,I test my command like this
and then I will get
System.IO.IOException: 句柄无效
errorthe Stack Trace like this
if I debug the
UnitTest
,it will not get the error.I think,the reason is
UnitTest
do not run in a shellso,how can I solve this problem?
or,what is the right way to
UnitTest
ShellProgressBar
?The text was updated successfully, but these errors were encountered: