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

            objAuthor.AddNewAuthor(NewAuthor);
            return(this.Ok());
        }
예제 #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));
        }
예제 #3
0
 public override void AddNewInvalidEntityShouldFail()
 {
     author.FirstName = "I";
     Assert.IsFalse(service.AddNewAuthor(author), "Expected validation to fail");
 }