public async Task SaveAsync_SessionProvided_SavesSession() { replServices.GetSupportedSaveFormats().Returns(new[] { "Markdown File (*.md)|*.md", "Best Format File (*.bff)|*.bff", }); saveDialogStub = saveFormats => new SaveDialog.SaveDialogResult(true, "TheBest.bff", 2); var inputData = new[] { CreateLine("\"Hello\" + \" World\"", "\"Hello World\"", null, null), CreateLine("", null, null, null), CreateLine("asdf", null, null, "asdf is undefined"), CreateLine("Console.WriteLine(4)", null, "4", null), }; // system under test await this.saveDialog.SaveAsync(inputData); await replServices .Received() .SaveSessionAsync( "TheBest.bff", "Best Format File (*.bff)|*.bff", Arg.Is <IReadOnlyCollection <LineToSave> >(lines => AssertSavedData(inputData, lines)) ); }
public async Task SaveAsync_SaveCanceled_DoesNotSave(bool?closeResult) { replServices.GetSupportedSaveFormats().Returns(new[] { "Markdown File (*.md)|*.md", "Best Format File (*.bff)|*.bff", }); // user cancels dialog saveDialogStub = saveFormats => new SaveDialog.SaveDialogResult(closeResult, null, 0); // system under test await this.saveDialog.SaveAsync(new[] { CreateLine("asdf", null, null, "asdf is not defined") }); await replServices .DidNotReceiveWithAnyArgs() .SaveSessionAsync(default, default, default);