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); } }
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()); } }
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); } }