public void JsonImport_NoFilename_Cancelled() { _expectedFileName = ""; var saveDialogMock = new Mock <ISaveFile>(); var openDialogMock = new Mock <IOpenFile>(); saveDialogMock.Setup(x => x.ShowDialog()).Returns(true).Verifiable(); saveDialogMock.Setup(x => x.FileName).Returns(_expectedFileName).Verifiable(); openDialogMock.Setup(x => x.ShowDialog()).Returns(true).Verifiable(); openDialogMock.Setup(x => x.FileName).Returns(_expectedFileName).Verifiable(); _jsonManager = new JsonManager(saveDialogMock.Object, openDialogMock.Object); Tour_LogJson erg = _jsonManager.JsonImport(); openDialogMock.Verify(); Assert.Null(erg); }
public void JsonImport_2Tours_3TourLogs() { _expectedFileName = @"C:\Users\Flori\source\repos\SWE2_Repos\TourPlanner\Test\TestJsonImport.json"; var saveDialogMock = new Mock <ISaveFile>(); var openDialogMock = new Mock <IOpenFile>(); saveDialogMock.Setup(x => x.ShowDialog()).Returns(true).Verifiable(); saveDialogMock.Setup(x => x.FileName).Returns(_expectedFileName).Verifiable(); openDialogMock.Setup(x => x.ShowDialog()).Returns(true).Verifiable(); openDialogMock.Setup(x => x.FileName).Returns(_expectedFileName).Verifiable(); _jsonManager = new JsonManager(saveDialogMock.Object, openDialogMock.Object); Tour_LogJson erg = _jsonManager.JsonImport(); openDialogMock.Verify(); Assert.True(erg.Tours.ToList().Count == 2); Assert.True(erg.TourLogs.ToList().Count == 3); }