Ejemplo n.º 1
0
        public void AddMoreCopiesOfBook_AddOneBookToEmptyList_ReturnCountNrOne()
        {
            ////Arrange

            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase("MDLibrary_AddMoreCopies")
                          .Options;

            var context = new ApplicationDbContext(options);

            var expectedResult = 1;

            var testBook = new BookCopy()
            {
                ID            = 1,
                BookDetailsID = 2
            };

            var testBookService = new BookServices(context);

            //Act

            testBookService.AddMoreCopiesOfBook(testBook);

            var actualResult = context.BookCopy.ToList().Count;

            //Assert
            Assert.Equal(expectedResult, actualResult);
        }