public static int Main(string[] args) { if (args.Length != 0) { Console.Write("Hello"); } string isbn = args[0]; string[] arr = args[0].Split('-'); if (arr[3] == "X") { arr[3] = "10"; } isbn = isbn.Replace("-", ""); int id = Int32.Parse(arr[3]); int lenStr = isbn.Length; if (lenStr == 10) { Isbn10 obj = new Isbn10(); obj.Isb10(args[0]); } else { Isbn13 obj = new Isbn13(); obj.Isb13(args[0]); } return(1); }
public void ISBN13Test() { var i = new Isbn13(); var expected = "[ISBN-10: 0-306-40615-2,ISBN-13: 978-0-306-40615-7]"; Assert.AreEqual(expected, Util.ArrayToString(i.ISBN13("0-306-40615"))); expected = "[ISBN-10: 0-307-94730-0,ISBN-13: 978-0-307-94730-7]"; Assert.AreEqual(expected, Util.ArrayToString(i.ISBN13("0307947300"))); expected = "[ISBN-10: 1-501-14353-0,ISBN-13: 978-1-501-14353-3]"; Assert.AreEqual(expected, Util.ArrayToString(i.ISBN13("1-501-14353"))); expected = "[ISBN-10: 0-307-74365-9,ISBN-13: 978-0-307-74365-7]"; Assert.AreEqual(expected, Util.ArrayToString(i.ISBN13("03-077-43657"))); expected = "[ISBN-10: 1-501-14206-2,ISBN-13: 978-1-501-14206-2]"; Assert.AreEqual(expected, Util.ArrayToString(i.ISBN13("150-114-206"))); }