Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
        }