/// <summary> /// Returns true if ISBN is valid. /// </summary> /// <param name="value">The value of the object to validate.</param> /// <returns> /// true if the specified value is valid; otherwise, false. /// </returns> public override bool IsValid(object value) { return(IsbnHelper.IsValidIsbn(value?.ToString())); }
public void Right10DigitalIsbn_Valid() { Assert.IsTrue(IsbnHelper.IsValidIsbn("0-684-84328-5")); Assert.IsTrue(IsbnHelper.IsValidIsbn("0-9752298-0-X")); }
public void WrongIsbn_Invalid() { Assert.IsFalse(IsbnHelper.IsValidIsbn("978 - 1")); Assert.IsFalse(IsbnHelper.IsValidIsbn("0-684-8432-5")); Assert.IsFalse(IsbnHelper.IsValidIsbn("0-9752298-G-X")); }
public void Right13DigitalIsbn_Valid() { Assert.IsTrue(IsbnHelper.IsValidIsbn("978 - 1420955095")); Assert.IsTrue(IsbnHelper.IsValidIsbn("978-3-16-148410-0")); }