コード例 #1
0
ファイル: TestBasics.cs プロジェクト: dielop101/KataPotterZgz
        public void TestBookByType(int idBook)
        {
            var bookList = new CollectionBooks();
            var book     = new Book(idBook, prizeConstant);

            bookList.AddBook(book);

            Assert.Equal(new Prize(8), potterService.PrizeBooks(bookList));
        }
コード例 #2
0
ファイル: TestBasics.cs プロジェクト: dielop101/KataPotterZgz
        public void TestBookCollection(int idBook, int numTimes)
        {
            var bookList = new CollectionBooks();
            var bookType = new Book(idBook, prizeConstant);

            for (var i = 0; i < numTimes; i++)
            {
                bookList.AddBook(bookType);
            }

            var prize = new Prize(8 * numTimes);

            Assert.Equal(prize, potterService.PrizeBooks(bookList));
        }
コード例 #3
0
        public void TestZeroZeroOneTwoTwoThree()
        {
            var bookList = new CollectionBooks();
            var bookZero = new Book(0, prizeConstant);

            bookList.AddBook(bookZero);
            bookList.AddBook(bookZero);
            var bookOne = new Book(1, prizeConstant);

            bookList.AddBook(bookOne);
            var bookTwo = new Book(2, prizeConstant);

            bookList.AddBook(bookTwo);
            bookList.AddBook(bookTwo);
            var bookThree = new Book(3, prizeConstant);

            bookList.AddBook(bookThree);

            Assert.Equal(new Prize((8 * 4 * 0.8) + (8 * 2 * 0.95)), potterService.PrizeBooks(bookList));
        }