Skip to content

Commit e98959b

Browse files
committed
fixed test setup
1 parent 3c56bf9 commit e98959b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Rubberduck.Core/UI/CodeExplorer/Commands/ExportCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public bool PromptFileNameAndExport(QualifiedModuleName qualifiedModule)
101101
try
102102
{
103103
var path = System.IO.Path.GetDirectoryName(dialog.FileName);
104-
component.ExportAsSourceFile(path);
104+
component.ExportAsSourceFile(path, false, true); // skipped optional parameters interfere with mock setup
105105
}
106106
catch (Exception ex)
107107
{

RubberduckTests/CodeExplorer/CodeExplorerViewModelTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,14 +1847,17 @@ public void ReplaceProjectContentsFromFiles_Cancel()
18471847
[Test]
18481848
public void ExportModule_ExpectExecution()
18491849
{
1850-
const string path = @"C:\Users\Rubberduck\Desktop\StdModule1.bas";
1850+
const string folder = @"C:\Users\Rubberduck\Desktop";
1851+
const string filename = "StdModule1.bas";
1852+
var path = Path.Combine(folder, filename);
18511853

18521854
using (var explorer = new MockedCodeExplorer(ProjectType.HostProject)
18531855
.ConfigureSaveDialog(path, DialogResult.OK)
18541856
.SelectFirstModule())
18551857
{
1858+
explorer.VbComponent.Setup(c => c.ExportAsSourceFile(folder, It.IsAny<bool>(), It.IsAny<bool>()));
18561859
explorer.ExecuteExportCommand();
1857-
explorer.VbComponent.Verify(c => c.Export(path), Times.Once);
1860+
explorer.VbComponent.Verify(c => c.ExportAsSourceFile(folder, false, true), Times.Once);
18581861
}
18591862
}
18601863

@@ -1868,8 +1871,11 @@ public void ExportModule_CancelPressed_ExpectNoExecution()
18681871
.ConfigureSaveDialog(path, DialogResult.Cancel)
18691872
.SelectFirstModule())
18701873
{
1874+
explorer.VbComponent.Setup(c => c.Export(path));
1875+
explorer.VbComponent.Setup(c => c.ExportAsSourceFile(path, It.IsAny<bool>(), It.IsAny<bool>()));
18711876
explorer.ExecuteExportCommand();
18721877
explorer.VbComponent.Verify(c => c.Export(path), Times.Never);
1878+
explorer.VbComponent.Verify(c => c.ExportAsSourceFile(path, It.IsAny<bool>(), It.IsAny<bool>()), Times.Never);
18731879
}
18741880
}
18751881

0 commit comments

Comments
 (0)