示例#1
0
        public void Validate_ISBN10_Checksum_validWithX()
        {
            string     ISBN = "043942089X";
            ISBNFinder sut  = new ISBNFinder();

            Assert.True(sut.checkISBN10(ISBN));
        }
示例#2
0
        public void Validate_ISBN10_Checksum_invalid()
        {
            string     ISBN = "0134757590";
            ISBNFinder sut  = new ISBNFinder();

            Assert.False(sut.checkISBN10(ISBN));
        }
示例#3
0
        public void Validate_ISBN10_Checksum()
        {
            string     ISBN = "0134757599";
            ISBNFinder sut  = new ISBNFinder();

            Assert.True(sut.checkISBN10(ISBN));
        }
示例#4
0
        public void ISBN_ValidateChecksum10WithX()
        {
            string ISBN = "043942089X";

            ISBNFinder sut    = new ISBNFinder();
            bool       actual = sut.validateCheckSum10(ISBN);

            Assert.True(actual);
        }
示例#5
0
        public void ISBN_BookAvailableFromFinder()
        {
            String unknownISBN = "0553562614";

            ISBNFinder sut    = new ISBNFinder();
            BookInfo   actual = sut.lookup(unknownISBN);

            Assert.Equal("Title not found", actual.Title);
        }
示例#6
0
        public void ISBN_LongerThan10Characters_ReturnsInvalidBookInfo()
        {
            string longISBN = "123456789ABCEDF";

            ISBNFinder sut    = new ISBNFinder();
            BookInfo   actual = sut.lookup(longISBN);

            Assert.Equal("ISBN must be 10 characters in length", actual.Title);
        }
示例#7
0
        public void ISBN10_Validate_Check_Sum()
        {
            var isbnNumber10 = "0471958697";

            ISBNFinder sut    = new ISBNFinder();
            BookInfo   actual = sut.lookup(isbnNumber10);

            Assert.Equal(7, sut.IsValidIsbn10(isbnNumber10));
        }
示例#8
0
        public void ISBN_StripDashesAndSpaces()
        {
            string ISBN = "04 -3942-089-X";

            ISBNFinder sut    = new ISBNFinder();
            string     actual = sut.stripDashAndSpace(ISBN);


            Assert.Equal("043942089X", actual);
        }
示例#9
0
        public void ISBN_CheckSumISBN10WithX()
        {
            string ISBN = "043942089X";

            ISBNFinder sut    = new ISBNFinder();
            string     actual = sut.calcCheckSum10(ISBN);


            Assert.Equal("X", actual.ToString());
        }
示例#10
0
        public void ISBN_CheckSumISBN10()
        {
            string ISBN = "0201485672";

            ISBNFinder sut    = new ISBNFinder();
            string     actual = sut.calcCheckSum10(ISBN);


            Assert.Equal("2", actual.ToString());
        }
示例#11
0
        public void Retrieve_ISB13()
        {
            var        ISBN   = "9780321146533";
            ISBNFinder sut    = new ISBNFinder();
            BookInfo   actual = sut.lookup(ISBN);

            BookInfo expected = new BookInfo("Test Driven Development by Example", "Kent Beck", "0321146530", "9780321146533");

            Assert.Equal(expected.ToString(), actual.ToString());
        }
示例#12
0
        public void ISBN_RemoveDashAndSpaceCheck()
        {
            string ISBN = "03-21146 530";

            ISBNFinder sut    = new ISBNFinder();
            BookInfo   actual = sut.lookup(ISBN);

            BookInfo expected = new BookInfo("Test Driven Development by Example", "Kent Beck", "0321146530", "9780321146533");

            Assert.Equal(expected.ToString(), actual.ToString());
        }
示例#13
0
        public void ISBN_ShorterThan10Characters_ReturnsInvalidBookInfo()
        {
            //Arrange
            string shortISBN = "12345";

            //Act
            ISBNFinder sut    = new ISBNFinder();
            BookInfo   actual = sut.lookup(shortISBN);

            //Assert
            Assert.Equal("ISBN must be 10 characters in length", actual.Title);
        }
示例#14
0
        public void goodCheckSum()
        {
            //Arrange
            string goodISBN = "9780131177055";

            //Act
            ISBNFinder sut = new ISBNFinder();

            //BookInfo actual = sut.lookup(goodISBN);

            //Assert
            Assert.True(sut.calcCheckSum13(goodISBN));
        }
示例#15
0
        public void validInputLength10()
        {
            //Arrange
            string goodISBN = "0134757599";

            //Act
            ISBNFinder sut = new ISBNFinder();

            //BookInfo actual = sut.lookup(goodISBN);

            //Assert
            Assert.True(sut.ValidInputLength(goodISBN));
        }