public IHttpActionResult AddNewAuthor(AuthorDTO NewAuthor)
        {
            AuthorService objAuthor = new AuthorService();

            objAuthor.AddNewAuthor(NewAuthor);
            return(this.Ok());
        }
Ejemplo n.º 2
0
        public void AuthorService_Create_OK()
        {
            var auth = new Author()
            {
                Books = new List <Book>()
                {
                    new Book()
                    {
                        Title = "MyTitle of my book", Year = 2019
                    }
                },
                LastName = "Marinelli",
                Name     = "Mike",
            };
            var service = new AuthorService();

            service.AddNewAuthor(auth);

            var authRead = service.GetAuthor(auth.Id);

            //Assert.AreEqual(authRead, auth);
            Assert.IsTrue(authRead.Equals(auth));
        }
Ejemplo n.º 3
0
 public override void AddNewInvalidEntityShouldFail()
 {
     author.FirstName = "I";
     Assert.IsFalse(service.AddNewAuthor(author), "Expected validation to fail");
 }