Пример #1
0
        public void ChangeDir()
        {
            var testDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            using (var ms = new MemoryStream())
            {
                var fakeShell = new Shell();
                fakeShell.ChangeDir(Path.GetFullPath(testDir + Path.DirectorySeparatorChar + @"TestFiles"));
                Assert.IsTrue(fakeShell.WorkingDirectory.EndsWith("TestFiles"));

                fakeShell.ChangeDir("..");
                Assert.IsTrue(fakeShell.WorkingDirectory == testDir);
            }
        }
Пример #2
0
        public async Task CompleteFileAsync()
        {
            using (var ms = new MemoryStream())
            {
                var fakeShell = new Shell();
                fakeShell.ChangeDir(Path.GetFullPath(basePath + "/../"));

                CmdSuggestions s      = new(fakeShell, FakeCommandsAsync());
                var            result = await s.GetSuggestionsAsync("cat TestFi", 10);

                Assert.AreEqual(1, result.Count());
            }
        }
Пример #3
0
        public async Task CompleteDirectoryAsync()
        {
            using (var ms = new MemoryStream())
            {
                var fakeShell = new Shell();
                fakeShell.ChangeDir(Path.GetFullPath(basePath + "/../"));

                CmdSuggestions s      = new(fakeShell, FakeCommandsAsync());
                var            result = await s.GetSuggestionsAsync("cd T", 4);

                Assert.AreEqual(1, result.Count());
                Assert.AreEqual("estFiles" + Path.DirectorySeparatorChar, result.ElementAt(0).CompletionText);
                Assert.AreEqual(4, result.ElementAt(0).Index);
            }
        }