public static bool CheckDigitIsCorrect(string isbn) { if (IsbnFormat.CorrectFormat(isbn) == false || StringHandling.IsValidInput(isbn) == false) { return(false); } isbn = StringHandling.RemoveWhiteSpaceAndDashes(isbn); if (IsbnFormat.ContainsNumbers(isbn) == false) { return(false); } List <int> isbnList = StringHandling.IsbnStringToList(isbn); int checkDigit = CheckDigit(isbnList); if (checkDigit == isbnList[12]) { return(true); } else { return(false); } }
public void removed_extra_characters() { string input = "a b c"; string inputRemoved = StringHandling.RemoveWhiteSpaceAndDashes(input); Assert.AreEqual("abc", inputRemoved); }
public void string_is_converted_to_list() { List <int> listOfNum = new List <int>(); listOfNum.Add(1); listOfNum.Add(2); listOfNum.Add(3); List <int> functionList = StringHandling.IsbnStringToList("123"); Assert.AreEqual(listOfNum, functionList); }
public void is_valid_string_input() { bool validInput = StringHandling.IsValidInput("aa"); Assert.AreEqual(true, validInput); }