public void Test_PushPopFolder() { Environment.CurrentDirectory = testFolder; CShell shell = new CShell(); shell.PushFolder("subfolder"); Assert.AreEqual(subFolder, Environment.CurrentDirectory, "CurrentDirectory should be changed"); Assert.AreEqual(subFolder, shell.CurrentFolder.FullName, "path should be changed"); Assert.AreEqual(subFolder, shell.FolderHistory.Last(), "history should be updated"); Assert.AreEqual(2, shell.FolderHistory.Count(), "history should be two"); Assert.AreEqual(1, shell.FolderStack.Count, "stack should be one"); shell.PushFolder("subfolder2"); Assert.AreEqual(subFolder2, Environment.CurrentDirectory, "CurrentDirectory should be changed"); Assert.AreEqual(subFolder2, shell.CurrentFolder.FullName, "path should be changed"); Assert.AreEqual(subFolder2, shell.FolderHistory.Last(), "history should be updated"); Assert.AreEqual(3, shell.FolderHistory.Count(), "history should be three"); Assert.AreEqual(2, shell.FolderStack.Count, "stack should be two"); shell.PopFolder(); Assert.AreEqual(subFolder, Environment.CurrentDirectory, "CurrentDirectory should be changed"); Assert.AreEqual(1, shell.FolderStack.Count, "stack should be one"); shell.PopFolder(); Assert.AreEqual(testFolder, Environment.CurrentDirectory, "CurrentDirectory should be changed"); Assert.AreEqual(0, shell.FolderStack.Count, "stack should be zero"); try { shell.PopFolder(); Assert.Fail("PopFolder() Should have thrown when empty"); } catch (Exception) { } }