-
Notifications
You must be signed in to change notification settings - Fork 235
Expand file tree
/
Copy pathConsoleWrapperTester.cs
More file actions
47 lines (40 loc) · 1.43 KB
/
ConsoleWrapperTester.cs
File metadata and controls
47 lines (40 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace Azure.Sdk.Tools.TestProxy.Console
{
/// <summary>
/// Implementation of IConsoleWrapper that will be used to test commands, like Reset, that require user input.
/// </summary>
public class ConsoleWrapperTester : IConsoleWrapper
{
private string _readLineResponse;
public ConsoleWrapperTester() { }
/// <summary>
/// Overloaded constructor takes in a string that'll be returned as the ReadLine response.
/// </summary>
/// <param name="readLineResponse">string that'll be returned as the ReadLine response</param>
public ConsoleWrapperTester(string readLineResponse)
{
_readLineResponse = readLineResponse;
}
/// <summary>
/// Set the ReadLine response.
/// </summary>
/// <param name="readLineResponse">string that'll be returned as the ReadLine response</param>
public void SetReadLineResponse(string readLineResponse)
{
_readLineResponse = readLineResponse;
}
public void Write(string message)
{
System.Console.Write(message);
}
public void WriteLine(string message)
{
System.Console.WriteLine(message);
}
public string ReadLine()
{
System.Console.WriteLine($"ReadLine response for test: '{_readLineResponse}'");
return _readLineResponse;
}
}
}