Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter13.15 bug fix #794

Merged
merged 7 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Chapter13.Tests/Listing13.15.Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

twoody0 marked this conversation as resolved.
Show resolved Hide resolved
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter13.Listing13_15.Tests;

[TestClass]
public class ProgramTests
{
[TestMethod]
public void MainTest()
BenjaminMichaelis marked this conversation as resolved.
Show resolved Hide resolved
{
const string expectedOutput = "ValidInput";
BenjaminMichaelis marked this conversation as resolved.
Show resolved Hide resolved
string simulatedInput = "\n \nValidInput\n";

IntelliTect.TestTools.Console.ConsoleAssert.Expect(
expectedOutput,
() =>
{
using (StringReader simulatedReader = new (simulatedInput))
{
Console.SetIn(simulatedReader);
Program.Main();
}
});
}
}
4 changes: 2 additions & 2 deletions src/Chapter13/Listing13.15.ParameterlessStatementLambdas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public static void Main()
{
input = Console.ReadLine();
}
while(!string.IsNullOrWhiteSpace(input));
while(string.IsNullOrWhiteSpace(input));
return input!;
};
//...
#endregion INCLUDE
getUserInput();
Console.WriteLine(getUserInput());
}
}
Loading