public void OnSaveClicked_ThrowsArgumentExceptionWhenFilePathIsNullOrEmpty(string filePath) { //Arrange var args = new SaveMapEventArgs(filePath); //Act _presenter.OnSaveClicked(null, args); //Assert //Test passes if expected exception is thrown }
public void OnSaveClicked(object sender, SaveMapEventArgs saveMapEventArgs) { if (saveMapEventArgs.FilePath == null || string.IsNullOrEmpty(saveMapEventArgs.FilePath.Trim())) throw new ArgumentException("A file path for network map must be provided."); if (!saveMapEventArgs.FilePath.EndsWith(_settings.MapFileExtension)) throw new InvalidMappingFileException(saveMapEventArgs.FilePath); try { _mapProvider.Save(saveMapEventArgs.FilePath); _view.NotifySaveCopmlete(); IsDirty = false; } catch (Exception ex) { throw new SaveNetworkMapException(saveMapEventArgs.FilePath, ex); } }