public void SaveCallsSaveAs() { // arrange var doc = new NewMarkpadDocument(fileSystem, documentFactory, "Title", "Content"); // act doc.Save(); // assert documentFactory.Received().SaveDocumentAs(doc); }
public async Task SaveAsSavesImages() { // arrange var bitmap = new Bitmap(1, 1); fileSystem.GetTempPath().Returns(@"c:\Temp"); fileSystem.OpenBitmap(Arg.Any<string>()).Returns(bitmap); var doc = new NewMarkpadDocument(fileSystem, documentFactory, "Title", "Content"); var markpadDocument = Substitute.For<IMarkpadDocument>(); documentFactory.SaveDocumentAs(doc).Returns(TaskEx.FromResult(markpadDocument)); doc.SaveImage(bitmap); // act await doc.Save(); // assert markpadDocument.Received().SaveImage(bitmap); }
public async Task SaveAsSavesImages() { // arrange var bitmap = new Bitmap(1, 1); fileSystem.GetTempPath().Returns(@"c:\Temp"); fileSystem.OpenBitmap(Arg.Any <string>()).Returns(bitmap); var doc = new NewMarkpadDocument(fileSystem, documentFactory, "Title", "Content"); var markpadDocument = Substitute.For <IMarkpadDocument>(); documentFactory.SaveDocumentAs(doc).Returns(TaskEx.FromResult(markpadDocument)); doc.SaveImage(bitmap); // act await doc.Save(); // assert markpadDocument.Received().SaveImage(bitmap); }