예제 #1
0
 public bool Testadd(adds adds)
 {
     if (bookService.Add(adds))
     {
         if (adds.BookName == "aaa")
         {
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
 /// <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);
 }
예제 #3
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));
        }
예제 #4
0
 public bool Add([FromServices] IBookService bookService, [FromBody] adds add)
 {
     return(bookService.Add(add));
 }