Example #1
0
        public bool AddAuthor([FromBody] Author data)
        {
            authorRepo.Add(data);
            _log.LogInformation($"The author that is added {JsonConvert.SerializeObject(data)}");

            return(true);
        }
        public void ShouldAddANewAuthorToList()
        {
            //arrange
            var newitem = new Author {
                authorid = 150, authorimage = "test image from add new", authorname = "newly added author", userid = 150
            };

            //act
            _mockrepo.Add(newitem);
            var obj = _mockrepo.FindByID(150);

            //assert
            Assert.AreEqual("newly added author", obj.authorname);
        }