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