public void Add_NoBooksInDatabase3Author_OneBookInsertedWithAuthor()
        {
            //Arrange
            this._ndbUnitTest.ReadXml("data/authors.xml");
            this._ndbUnitTest.PerformDbOperation(NDbUnit.Core.DbOperationFlag.Insert);
            Author author = this._dataContext.GetById<Author>(1);

            //Act
            Book book = new Book(){Name="Book 01", Price = 8, Author = author};
            this._dataContext.Add<Book>(book);

            //Assert
            DataSet dataSet = this._ndbUnitTest.GetDataSetFromDb();
        }
Пример #2
0
        public void Add_NoBooksInDatabase3Author_OneBookInsertedWithAuthor()
        {
            // Arrange
            this._ndbUnitTest.ReadXml("data/authors.xml");
            this._ndbUnitTest.PerformDbOperation(NDbUnit.Core.DbOperationFlag.Insert);
            Author author = this._dataContext.GetById<Author>(1);

            // Act
            Book book = new Book(){  Name ="Book 01", Price = 8, Author = author };
            this._dataContext.Add<Book>(book);

            // Assert
            DataSet dataSet = this._ndbUnitTest.GetDataSetFromDb();
            Assert.AreEqual(3, dataSet.Tables["authors"].Rows.Count);
            Assert.AreEqual(1, dataSet.Tables["books"].Rows.Count);

            DataRow bookDataRow = dataSet.Tables["books"].Rows[0];
            Assert.AreEqual(1, bookDataRow["author_id"]);
        }
Пример #3
0
 public OrderItem(Book book)
 {
     this.Book = book;
 }
Пример #4
0
        public Book TotalBookDesc(Book bookItem, int quantity, double Desc)
        {
            Book book = new Book() { Price = (bookItem.Price * quantity)-(1.00+Desc) };

            return book;
        }
Пример #5
0
        public Book TotalBook(Book bookItem, int quantity)
        {
            Book book = new Book() { Price = bookItem.Price * quantity };

            return book;
        }