public Notebook Get(int id) { try { Web.Models.Notebook response = api.GetNotebook(id); if (response.HasError) { throw new DataSourceException("The API returned an error"); } return(converter.ReverseConvert(response)); } catch (WebApiException e) { throw new DataSourceException("Could not get notebook", e); } }
public void NotebookCanBeConverted() { IConverter <Notebook, Chronicy.Web.Models.Notebook> converter = new NotebookConverter(); Notebook initial = new Notebook("A Notebook"); Chronicy.Web.Models.Notebook webNotebook = converter.Convert(initial); Notebook convertedBack = converter.ReverseConvert(webNotebook); Assert.AreEqual(initial, convertedBack); }