예제 #1
0
        public void ConvertISBN10ToEan13Examples()
        {
            //Convert to Ean13 directly
            if (Ean13.TryConvertFomISBN10("0306406152", out var ean13) == Ean13.ResultCode.Success)
            {
                Console.WriteLine($"Convert ISBN10 from string; Ean13: {ean13.Ean13Code} Checksum: {ean13.Checksum}");
            }

            //Pass an ISBN10 struct
            if (ISBN10.TryParse("0306406152", out var isbn10) == ISBN10.ResultCode.Success)
            {
                if (Ean13.TryConvertFomISBN10(isbn10, out ean13) == Ean13.ResultCode.Success)
                {
                    Console.WriteLine($"Convert ISBN10 from struct; Ean13: {ean13.Ean13Code} Checksum: {ean13.Checksum}");
                }
            }
        }
예제 #2
0
 public void FromISBN10Test(string isbn10Str, long expected)
 {
     ISBN10.TryParse(isbn10Str, out var isbn10);
     Ean13.TryConvertFomISBN10(isbn10, out var ean13).Should().Be(Ean13.ResultCode.Success);
     ean13.Ean13Code.Should().Be(expected);
 }