public bool Testadd(adds adds) { if (bookService.Add(adds)) { if (adds.BookName == "aaa") { return(true); } } return(false); }
/// <summary> /// 增加 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool Add(adds add) { Context.BookRepos.Add(new BookRepo() { Name = add.BookName, Price = add.Price, PublishDate = add.PublishDate, Description = add.Description }); return(Context.SaveChanges() > 0); }
public void Returnadd() { var mock = new Mock <IBookService>(); adds add = new adds(); add.BookName = "aaa"; add.Author = "bbb"; mock.Setup(repo => repo.Add(add)).Returns(true); test = new testbook(mock.Object); Assert.True(test.Testadd(add)); }
public bool Add([FromServices] IBookService bookService, [FromBody] adds add) { return(bookService.Add(add)); }