Ejemplo n.º 1
0
        public Task Should_Render_Padded_Object_Correctly_When_Nested_Within_Other_Object()
        {
            // Given
            var console = new FakeConsole(width: 60);
            var table   = new Table();

            table.AddColumn("Foo");
            table.AddColumn("Bar", c => c.PadLeft(0).PadRight(0));
            table.AddRow("Baz", "Qux");
            table.AddRow(new Text("Corgi"), new Padder(new Panel("Waldo"))
                         .Padding(2, 1));

            // When
            console.Render(new Padder(table)
                           .Padding(1, 2, 3, 4)
                           .Expand());

            // Then
            return(Verifier.Verify(console.Output));
        }
Ejemplo n.º 2
0
		public void Init_Shutdown_Cleans_Up ()
		{
			// Verify initial state is per spec
			Pre_Init_State ();

			Application.Init (new FakeDriver (), new FakeMainLoop (() => FakeConsole.ReadKey (true)));

			// Verify post-Init state is correct
			Post_Init_State ();

			// MockDriver is always 80x25
			Assert.Equal (80, Application.Driver.Cols);
			Assert.Equal (25, Application.Driver.Rows);

			Application.Shutdown ();

			// Verify state is back to initial
			Pre_Init_State ();

		}
Ejemplo n.º 3
0
        public void Run_Runs_Idle_Stop_Stops_Idle()
        {
            var ml = new MainLoop(new FakeMainLoop(() => FakeConsole.ReadKey(true)));

            var         functionCalled = 0;
            Func <bool> fn             = () => {
                functionCalled++;
                if (functionCalled == 10)
                {
                    ml.Stop();
                }
                return(true);
            };

            ml.AddIdle(fn);
            ml.Run();
            Assert.True(ml.RemoveIdle(fn));

            Assert.Equal(10, functionCalled);
        }
Ejemplo n.º 4
0
        public Task Should_Render_Rows()
        {
            // Given
            var console = new FakeConsole(width: 60);
            var rows    = new Rows(
                new IRenderable[]
            {
                new Markup("Hello"),
                new Table()
                .AddColumns("Foo", "Bar")
                .AddRow("Baz", "Qux"),
                new Markup("World"),
            });

            // When
            console.Write(rows);

            // Then
            return(Verifier.Verify(console.Output));
        }
Ejemplo n.º 5
0
            public void Should_Default_To_30_Width()
            {
                // Given
                var      context  = Substitute.For <ICakeContext>();
                var      console  = new FakeConsole();
                var      report   = new CakeReport();
                string   taskName = "TaskName";
                TimeSpan duration = TimeSpan.FromSeconds(10);

                report.Add(taskName, duration);
                var printer = new CakeReportPrinter(console, context);

                // When
                printer.Write(report);

                // Then
                string expected = String.Format("{0,-30}{1,-20}", taskName, duration);

                Assert.Contains(console.Messages, s => s == expected);
            }
Ejemplo n.º 6
0
        public Task Should_Render_Table_With_Cell_Padding_Correctly()
        {
            // Given
            var console = new FakeConsole(width: 80);
            var table   = new Table();

            table.AddColumns("Foo", "Bar");
            table.AddColumn(new TableColumn("Baz")
            {
                Padding = new Padding(3, 0, 2, 0)
            });
            table.AddRow("Qux\nQuuux", "Corgi", "Waldo");
            table.AddRow("Grault", "Garply", "Fred");

            // When
            console.Write(table);

            // Then
            return(Verifier.Verify(console.Output));
        }
Ejemplo n.º 7
0
        public void Setting_Value_To_MaxValue_Should_Finish_Task()
        {
            // Given
            var task     = default(ProgressTask);
            var console  = new FakeConsole();
            var progress = new Progress(console)
                           .Columns(new[] { new ProgressBarColumn() })
                           .AutoRefresh(false)
                           .AutoClear(false);

            // When
            progress.Start(ctx =>
            {
                task       = ctx.AddTask("foo");
                task.Value = task.MaxValue;
            });

            // Then
            task.IsFinished.ShouldBe(true);
        }
Ejemplo n.º 8
0
        public Task Should_Render_Table_With_Title_And_Caption_Correctly()
        {
            // Given
            var console = new FakeConsole(width: 80);
            var table   = new Table {
                Border = TableBorder.Rounded
            };

            table.Title   = new TableTitle("Hello World");
            table.Caption = new TableTitle("Goodbye World");
            table.AddColumns("Foo", "Bar", "Baz");
            table.AddRow("Qux", "Corgi", "Waldo");
            table.AddRow("Grault", "Garply", "Fred");

            // When
            console.Write(table);

            // Then
            return(Verifier.Verify(console.Output));
        }
Ejemplo n.º 9
0
        public void Pos_Validation_Do_Not_Throws_If_NewValue_Is_PosAbsolute_And_OldValue_Is_Null()
        {
            Application.Init(new FakeDriver(), new FakeMainLoop(() => FakeConsole.ReadKey(true)));

            var t = Application.Top;

            var w = new Window(new Rect(1, 2, 4, 5), "w");

            t.Add(w);

            t.Ready += () => {
                Assert.Equal(2, w.X = 2);
                Assert.Equal(2, w.Y = 2);
            };

            Application.Iteration += () => Application.RequestStop();

            Application.Run();
            Application.Shutdown();
        }
Ejemplo n.º 10
0
        public Task Should_Render_Rows_Correctly_Inside_Other_Widget_When_Expanded()
        {
            // Given
            var console = new FakeConsole(width: 60);
            var table   = new Table()
                          .AddColumns("Foo", "Bar")
                          .AddRow("HELLO WORLD")
                          .AddRow(
                new Rows(new IRenderable[]
            {
                new Markup("Hello"),
                new Markup("World"),
            }).Expand(), new Text("Qux"));

            // When
            console.Write(table);

            // Then
            return(Verifier.Verify(console.Output));
        }
Ejemplo n.º 11
0
        public void SetColors_Changes_Colors()
        {
            var driver = new FakeDriver();

            Application.Init(driver, new FakeMainLoop(() => FakeConsole.ReadKey(true)));
            driver.Init(() => { });
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);

            Console.ForegroundColor = ConsoleColor.Red;
            Assert.Equal(ConsoleColor.Red, Console.ForegroundColor);

            Console.BackgroundColor = ConsoleColor.Green;
            Assert.Equal(ConsoleColor.Green, Console.BackgroundColor);

            Console.ResetColor();
            Assert.Equal(ConsoleColor.Gray, Console.ForegroundColor);
            Assert.Equal(ConsoleColor.Black, Console.BackgroundColor);
            driver.End();
        }
Ejemplo n.º 12
0
        public async Task Help_text_is_printed_if_no_arguments_are_provided_and_the_default_command_is_not_defined()
        {
            // Arrange
            var application = new CliApplicationBuilder()
                              .UseConsole(FakeConsole)
                              .SetDescription("This will be in help text")
                              .Build();

            // Act
            var exitCode = await application.RunAsync(
                Array.Empty <string>(),
                new Dictionary <string, string>()
                );

            var stdOut = FakeConsole.ReadOutputString();

            // Assert
            exitCode.Should().Be(0);
            stdOut.Should().Contain("This will be in help text");
        }
Ejemplo n.º 13
0
        public void CanFocus_Faced_With_Container_After_Run()
        {
            Application.Init(new FakeDriver(), new NetMainLoop(() => FakeConsole.ReadKey(true)));

            var t = Application.Top;

            var w = new Window("w");
            var f = new FrameView("f");
            var v = new View("v")
            {
                CanFocus = true
            };

            f.Add(v);
            w.Add(f);
            t.Add(w);

            t.Ready += () => {
                Assert.True(t.CanFocus);
                Assert.True(w.CanFocus);
                Assert.True(f.CanFocus);
                Assert.True(v.CanFocus);

                f.CanFocus = false;
                Assert.False(f.CanFocus);
                Assert.False(v.CanFocus);

                v.CanFocus = false;
                Assert.False(f.CanFocus);
                Assert.False(v.CanFocus);

                v.CanFocus = true;
                Assert.True(f.CanFocus);
                Assert.True(v.CanFocus);
            };

            Application.Iteration += () => Application.RequestStop();

            Application.Run();
            Application.Shutdown();
        }
Ejemplo n.º 14
0
        public void TerminalResized_Simulation()
        {
            var driver = new FakeDriver();

            Application.Init(driver, new FakeMainLoop(() => FakeConsole.ReadKey(true)));
            var wasTerminalResized = false;

            Application.Resized = (e) => {
                wasTerminalResized = true;
                Assert.Equal(120, e.Cols);
                Assert.Equal(40, e.Rows);
            };

            Assert.Equal(80, Console.BufferWidth);
            Assert.Equal(25, Console.BufferHeight);

            // MockDriver is by default 80x25
            Assert.Equal(Console.BufferWidth, driver.Cols);
            Assert.Equal(Console.BufferHeight, driver.Rows);
            Assert.False(wasTerminalResized);

            // MockDriver will now be sets to 120x40
            driver.SetBufferSize(120, 40);
            Assert.Equal(120, Application.Driver.Cols);
            Assert.Equal(40, Application.Driver.Rows);
            Assert.True(wasTerminalResized);

            // MockDriver will still be 120x40
            wasTerminalResized         = false;
            Application.HeightAsBuffer = true;
            driver.SetWindowSize(40, 20);
            Assert.Equal(120, Application.Driver.Cols);
            Assert.Equal(40, Application.Driver.Rows);
            Assert.Equal(120, Console.BufferWidth);
            Assert.Equal(40, Console.BufferHeight);
            Assert.Equal(40, Console.WindowWidth);
            Assert.Equal(20, Console.WindowHeight);
            Assert.True(wasTerminalResized);

            Application.Shutdown();
        }
Ejemplo n.º 15
0
    public async Task Fake_console_can_be_used_with_an_in_memory_backing_store()
    {
        // Arrange
        var commandType = DynamicCommandBuilder.Compile(
            // language=cs
            @"
[Command]
public class Command : ICommand
{   
    public ValueTask ExecuteAsync(IConsole console)
    {
        var input = console.Input.ReadToEnd();
        console.Output.WriteLine(input);
        console.Error.WriteLine(input);

        return default;
    }
}
");

        var application = new CliApplicationBuilder()
                          .AddCommand(commandType)
                          .UseConsole(FakeConsole)
                          .Build();

        // Act
        FakeConsole.WriteInput("Hello world");

        var exitCode = await application.RunAsync(
            Array.Empty <string>(),
            new Dictionary <string, string>()
            );

        var stdOut = FakeConsole.ReadOutputString();
        var stdErr = FakeConsole.ReadErrorString();

        // Assert
        exitCode.Should().Be(0);
        stdOut.Trim().Should().Be("Hello world");
        stdErr.Trim().Should().Be("Hello world");
    }
Ejemplo n.º 16
0
        public async Task Help_text_shows_all_parameters_and_options()
        {
            // Arrange
            var commandType = DynamicCommandBuilder.Compile(
                // language=cs
                @"
[Command]
public class Command : ICommand
{
    [CommandParameter(0, Name = ""foo"", Description = ""Description of foo."")]
    public string Foo { get; set; }
    
    [CommandOption(""bar"", Description = ""Description of bar."")]
    public string Bar { get; set; }
    
    public ValueTask ExecuteAsync(IConsole console) => default;
}
");

            var application = new CliApplicationBuilder()
                              .AddCommand(commandType)
                              .UseConsole(FakeConsole)
                              .Build();

            // Act
            var exitCode = await application.RunAsync(
                new[] { "--help" },
                new Dictionary <string, string>()
                );

            var stdOut = FakeConsole.ReadOutputString();

            // Assert
            exitCode.Should().Be(0);
            stdOut.Should().ContainAllInOrder(
                "PARAMETERS",
                "foo", "Description of foo.",
                "OPTIONS",
                "--bar", "Description of bar."
                );
        }
Ejemplo n.º 17
0
    public async Task Parameter_or_option_value_conversion_fails_if_the_static_parse_method_throws()
    {
        // Arrange
        var commandType = DynamicCommandBuilder.Compile(
            // language=cs
            @"
public class CustomType
{
    public string Value { get; }

    private CustomType(string value) => Value = value;

    public static CustomType Parse(string value) => throw new Exception(""Hello world"");
}

[Command]
public class Command : ICommand
{
    [CommandOption('f')]
    public CustomType Foo { get; set; }

    public ValueTask ExecuteAsync(IConsole console) => default;
}
");
        var application = new CliApplicationBuilder()
                          .AddCommand(commandType)
                          .UseConsole(FakeConsole)
                          .Build();

        // Act
        var exitCode = await application.RunAsync(
            new[] { "-f", "bar" },
            new Dictionary <string, string>()
            );

        var stdErr = FakeConsole.ReadErrorString();

        // Assert
        exitCode.Should().NotBe(0);
        stdErr.Should().Contain("Hello world");
    }
Ejemplo n.º 18
0
            public void Should_Increase_Width_For_Long_Task_Names()
            {
                // Given
                var      console   = new FakeConsole();
                var      report    = new CakeReport();
                string   taskName  = "TaskName";
                string   taskName2 = "Task-Name-That-Has-A-Length-Of-44-Characters";
                TimeSpan duration  = TimeSpan.FromSeconds(10);

                report.Add(taskName, duration);
                report.Add(taskName2, duration);
                var printer = new CakeReportPrinter(console);

                // When
                printer.Write(report);

                // Then
                string expected = String.Format("{0,-45}{1,-20}", taskName, duration);

                Assert.Contains(console.Messages, s => s == expected);
            }
Ejemplo n.º 19
0
        public void Should_Increment_Manually_Set_Value()
        {
            // Given
            var task     = default(ProgressTask);
            var console  = new FakeConsole();
            var progress = new Progress(console)
                           .Columns(new[] { new ProgressBarColumn() })
                           .AutoRefresh(false)
                           .AutoClear(false);

            // When
            progress.Start(ctx =>
            {
                task       = ctx.AddTask("foo");
                task.Value = 50;
                task.Increment(10);
            });

            // Then
            task.Value.ShouldBe(60);
        }
Ejemplo n.º 20
0
        public Task Should_Render_Grid_Correctly_2()
        {
            var console = new FakeConsole(width: 80);
            var grid    = new Grid();

            grid.AddColumn(new GridColumn {
                NoWrap = true
            });
            grid.AddColumn(new GridColumn {
                Padding = new Padding(2, 0, 0, 0)
            });
            grid.AddRow("[bold]Options[/]", string.Empty);
            grid.AddRow("  [blue]-h[/], [blue]--help[/]", "Show command line help.");
            grid.AddRow("  [blue]-c[/], [blue]--configuration[/]", "The configuration to run for.\nThe default for most projects is [green]Debug[/].");

            // When
            console.Write(grid);

            // Then
            return(Verifier.Verify(console.Output));
        }
Ejemplo n.º 21
0
        public async Task Version_text_is_printed_if_provided_arguments_contain_the_version_option()
        {
            // Arrange
            var application = new CliApplicationBuilder()
                              .AddCommand <NoOpCommand>()
                              .SetVersion("v6.9")
                              .UseConsole(FakeConsole)
                              .Build();

            // Act
            var exitCode = await application.RunAsync(
                new[] { "--version" },
                new Dictionary <string, string>()
                );

            var stdOut = FakeConsole.ReadOutputString();

            // Assert
            exitCode.Should().Be(0);
            stdOut.Trim().Should().Be("v6.9");
        }
Ejemplo n.º 22
0
        public TextViewTests()
        {
            Application.Init(new FakeDriver(), new FakeMainLoop(() => FakeConsole.ReadKey(true)));

            //                   1         2         3
            //         01234567890123456789012345678901=32 (Length)
            var txt  = "TAB to jump between text fields.";
            var buff = new byte [txt.Length];

            for (int i = 0; i < txt.Length; i++)
            {
                buff [i] = (byte)txt [i];
            }
            var ms = new System.IO.MemoryStream(buff).ToArray();

            _textView = new TextView()
            {
                Width = 30, Height = 10
            };
            _textView.Text = ms;
        }
Ejemplo n.º 23
0
        public void FakeDriver_MockKeyPresses()
        {
            Application.Init(new FakeDriver(), new FakeMainLoop(() => FakeConsole.ReadKey(true)));

            var text  = "MockKeyPresses";
            var mKeys = new Stack <ConsoleKeyInfo> ();

            foreach (var r in text.Reverse())
            {
                var ck  = char.IsLetter(r) ? (ConsoleKey)char.ToUpper(r) : (ConsoleKey)r;
                var cki = new ConsoleKeyInfo(r, ck, false, false, false);
                mKeys.Push(cki);
            }
            FakeConsole.MockKeyPresses = mKeys;

            var top   = Application.Top;
            var view  = new View();
            var rText = "";
            var idx   = 0;

            view.KeyPress += (e) => {
                Assert.Equal(text [idx], (char)e.KeyEvent.Key);
                rText += (char)e.KeyEvent.Key;
                Assert.Equal(rText, text.Substring(0, idx + 1));
                e.Handled = true;
                idx++;
            };
            top.Add(view);

            Application.Iteration += () => {
                if (mKeys.Count == 0)
                {
                    Application.RequestStop();
                }
            };

            Application.Run();

            Assert.Equal("MockKeyPresses", rText);
        }
Ejemplo n.º 24
0
        public void CanFocus_Container_ToFalse_Turns_All_Subviews_ToFalse_Too()
        {
            Application.Init(new FakeDriver(), new NetMainLoop(() => FakeConsole.ReadKey(true)));

            var t = Application.Top;

            var w  = new Window("w");
            var f  = new FrameView("f");
            var v1 = new View("v1")
            {
                CanFocus = true
            };
            var v2 = new View("v2")
            {
                CanFocus = true
            };

            f.Add(v1, v2);
            w.Add(f);
            t.Add(w);

            t.Ready += () => {
                Assert.True(t.CanFocus);
                Assert.True(w.CanFocus);
                Assert.True(f.CanFocus);
                Assert.True(v1.CanFocus);
                Assert.True(v2.CanFocus);

                w.CanFocus = false;
                Assert.True(w.CanFocus);
                Assert.False(f.CanFocus);
                Assert.False(v1.CanFocus);
                Assert.False(v2.CanFocus);
            };

            Application.Iteration += () => Application.RequestStop();

            Application.Run();
            Application.Shutdown();
        }
Ejemplo n.º 25
0
        public async Task Option_of_scalar_type_always_receives_a_single_value_from_an_environment_variable()
        {
            // Arrange
            var commandType = DynamicCommandBuilder.Compile(
                // language=cs
                @"
[Command]
public class Command : ICommand
{
    [CommandOption(""foo"", EnvironmentVariable = ""ENV_FOO"")]
    public string Foo { get; set; }
    
    public ValueTask ExecuteAsync(IConsole console)
    {
        console.Output.WriteLine(Foo);
        return default;
    }
}
");

            var application = new CliApplicationBuilder()
                              .AddCommand(commandType)
                              .UseConsole(FakeConsole)
                              .Build();

            // Act
            var exitCode = await application.RunAsync(
                Array.Empty <string>(),
                new Dictionary <string, string>
            {
                ["ENV_FOO"] = $"bar{Path.PathSeparator}baz"
            }
                );

            var stdOut = FakeConsole.ReadOutputString();

            // Assert
            exitCode.Should().Be(0);
            stdOut.Trim().Should().Be($"bar{Path.PathSeparator}baz");
        }
Ejemplo n.º 26
0
        public async Task Option_does_not_fall_back_to_an_environment_variable_if_a_value_is_provided_through_arguments()
        {
            // Arrange
            var commandType = DynamicCommandBuilder.Compile(
                // language=cs
                @"
[Command]
public class Command : ICommand
{
    [CommandOption(""foo"", EnvironmentVariable = ""ENV_FOO"")]
    public string Foo { get; set; }
    
    public ValueTask ExecuteAsync(IConsole console)
    {
        console.Output.WriteLine(Foo);
        return default;
    }
}
");

            var application = new CliApplicationBuilder()
                              .AddCommand(commandType)
                              .UseConsole(FakeConsole)
                              .Build();

            // Act
            var exitCode = await application.RunAsync(
                new[] { "--foo", "baz" },
                new Dictionary <string, string>
            {
                ["ENV_FOO"] = "bar"
            }
                );

            var stdOut = FakeConsole.ReadOutputString();

            // Assert
            exitCode.Should().Be(0);
            stdOut.Trim().Should().Be("baz");
        }
Ejemplo n.º 27
0
        public override void Refresh()
        {
            int rows = Rows;
            int cols = Cols;

            var savedRow = FakeConsole.CursorTop;
            var savedCol = FakeConsole.CursorLeft;

            for (int row = 0; row < rows; row++)
            {
                if (!dirtyLine [row])
                {
                    continue;
                }
                dirtyLine [row] = false;
                for (int col = 0; col < cols; col++)
                {
                    if (contents [row, col, 2] != 1)
                    {
                        continue;
                    }

                    FakeConsole.CursorTop  = row;
                    FakeConsole.CursorLeft = col;
                    for (; col < cols && contents [row, col, 2] == 1; col++)
                    {
                        var color = contents [row, col, 1];
                        if (color != redrawColor)
                        {
                            SetColor(color);
                        }

                        FakeConsole.Write((char)contents [row, col, 0]);
                        contents [row, col, 2] = 0;
                    }
                }
            }
            FakeConsole.CursorTop  = savedRow;
            FakeConsole.CursorLeft = savedCol;
        }
Ejemplo n.º 28
0
        public void Constuctors_Constuct()
        {
            var driver = new FakeDriver();

            Application.Init(driver, new FakeMainLoop(() => FakeConsole.ReadKey(true)));
            driver.Init(() => { });

            // Test parameterless constructor
            var attr = new Attribute();

            Assert.Equal(default(int), attr.Value);
            Assert.Equal(default(Color), attr.Foreground);
            Assert.Equal(default(Color), attr.Background);

            // Test value, foreground, background
            var value = 42;
            var fg    = new Color();

            fg = Color.Red;

            var bg = new Color();

            bg = Color.Blue;

            attr = new Attribute(value, fg, bg);

            Assert.Equal(value, attr.Value);
            Assert.Equal(fg, attr.Foreground);
            Assert.Equal(bg, attr.Background);

            // value, foreground, background
            attr = new Attribute(fg, bg);

            Assert.Equal(fg, attr.Foreground);
            Assert.Equal(bg, attr.Background);

            driver.End();
            Application.Shutdown();
        }
Ejemplo n.º 29
0
        public void Setting_Max_Value_Should_Set_The_MaxValue_And_Cap_Value()
        {
            // Given
            var task     = default(ProgressTask);
            var console  = new FakeConsole();
            var progress = new Progress(console)
                           .Columns(new[] { new ProgressBarColumn() })
                           .AutoRefresh(false)
                           .AutoClear(false);

            // When
            progress.Start(ctx =>
            {
                task = ctx.AddTask("foo");
                task.Increment(100);
                task.MaxValue = 20;
            });

            // Then
            task.MaxValue.ShouldBe(20);
            task.Value.ShouldBe(20);
        }
Ejemplo n.º 30
0
        public override void UpdateScreen()
        {
            int rows = Rows;
            int cols = Cols;

            FakeConsole.CursorTop  = 0;
            FakeConsole.CursorLeft = 0;
            for (int row = 0; row < rows; row++)
            {
                dirtyLine [row] = false;
                for (int col = 0; col < cols; col++)
                {
                    contents [row, col, 2] = 0;
                    var color = contents [row, col, 1];
                    if (color != redrawColor)
                    {
                        SetColor(color);
                    }
                    FakeConsole.Write((char)contents [row, col, 0]);
                }
            }
        }
Ejemplo n.º 31
0
 public RunTests(TextBox output)
 {
     _fakeConsole = new FakeConsole(output);
 }
Ejemplo n.º 32
0
            public void ShouldPromptForInput()
            {
                var mockFileSystem = new Mock<IFileSystem>();
                mockFileSystem.SetupGet(x => x.CurrentDirectory).Returns("C:\\");

                var builder = new StringBuilder();

                var reader = new StringReader(Environment.NewLine);
                var writer = new StringWriter(builder);

                var console = new FakeConsole(writer, reader);

                var root = new ScriptServiceRoot(
                    mockFileSystem.Object,
                    Mock.Of<IPackageAssemblyResolver>(),
                    Mock.Of<IScriptExecutor>(),
                    Mock.Of<IScriptEngine>(),
                    Mock.Of<IFilePreProcessor>(),
                    Mock.Of<IScriptPackResolver>(),
                    Mock.Of<IPackageInstaller>(),
                    Mock.Of<ILog>(),
                    Mock.Of<IAssemblyName>(),
                    console);

                var commandFactory = new CommandFactory(root);

                var target = commandFactory.CreateCommand(new ScriptCsArgs { Repl = true }, new string[0]);

                target.Execute();

                Assert.True(builder.ToString().EndsWith("> "));
                Assert.Equal(1, console.ReadLineCounter);
            }
Ejemplo n.º 33
0
 public void Setup()
 {
     _fileService = new Mock<IFileService>();
     _wordSplitter = new Mock<IWordSplitter>();
     _wordCounter = new Mock<IWordCounter>();
     _wordCounter.Setup(q => q.Count(It.IsAny<string[]>())).Returns(new Dictionary<string, int>());
     _console = new FakeConsole();
     _compoundFilter = new Mock<ICompoundFilter>();
     _judoTestApp = new JudoTestApp(_fileService.Object, _wordSplitter.Object, _wordCounter.Object, _console, _compoundFilter.Object);
 }