From 618beeaf2c40cfd1a136de9eb3642ce4076e9223 Mon Sep 17 00:00:00 2001 From: Benjamin Popp Date: Sat, 27 Oct 2018 10:33:50 -0500 Subject: [PATCH] added a new test for showing the functionality of the save all command --- HexTests/GeneralAppTests.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/HexTests/GeneralAppTests.cs b/HexTests/GeneralAppTests.cs index e55bf0d8..5d860e24 100644 --- a/HexTests/GeneralAppTests.cs +++ b/HexTests/GeneralAppTests.cs @@ -14,7 +14,7 @@ namespace HavenSoft.HexTests { [Fact] public void ApplicationOpensWithNoTabs() { - Assert.Empty(editor); + Assert.Equal(0, editor.Count); Assert.Equal(-1, editor.SelectedIndex); } @@ -102,5 +102,19 @@ namespace HavenSoft.HexTests { editor.Save.Execute(); Assert.Equal(10, executeCount); } + + [Fact] + public void SaveAllSavesAllDocumentsThatNeedSaving() { + int executeCount = 0; + + var save = new StubCommand { CanExecute = arg => true, Execute = arg => executeCount++ }; + var noSave = new StubCommand { CanExecute = arg => false, Execute = arg => executeCount++ }; + editor.Add(new StubTabContent { Save = save }); + editor.Add(new StubTabContent { Save = noSave }); + editor.Add(new StubTabContent { Save = save }); + + editor.SaveAll.Execute(); + Assert.Equal(2, executeCount); + } } }