public void VerifyShouldReturnFalseIfBirthNumberIsNotOfLength11() { NorwegianBirthNumber.Verify("").Should().BeFalse(); NorwegianBirthNumber.Verify("1").Should().BeFalse(); NorwegianBirthNumber.Verify("1234567890").Should().BeFalse(); NorwegianBirthNumber.Verify("123456789012").Should().BeFalse(); }
public void VerifyShouldIgnoreSpace() { NorwegianBirthNumber.Verify(" 19089328341").Should().BeTrue(); NorwegianBirthNumber.Verify("19089328341 ").Should().BeTrue(); NorwegianBirthNumber.Verify("190893 28341").Should().BeTrue(); NorwegianBirthNumber.Verify("190893 28341 ").Should().BeTrue(); }
public void ShouldNotVerifyInvalidBirthNumbers() { NorwegianBirthNumber.Verify("19089328311").Should().BeFalse(); NorwegianBirthNumber.Verify("08011129410").Should().BeFalse(); NorwegianBirthNumber.Verify("08063048618").Should().BeFalse(); NorwegianBirthNumber.Verify("01027244516").Should().BeFalse(); NorwegianBirthNumber.Verify("20041622012").Should().BeFalse(); NorwegianBirthNumber.Verify("24015706210").Should().BeFalse(); NorwegianBirthNumber.Verify("08055207418").Should().BeFalse(); NorwegianBirthNumber.Verify("22067937214").Should().BeFalse(); NorwegianBirthNumber.Verify("28090607816").Should().BeFalse(); }
protected override void DoRun(Field field) { string value = field.Value; bool ok = NorwegianBirthNumber.Verify(value); if (!ok) { _testResults.Add(new TestResult(ResultType.Error, AddmlLocation.FromFieldIndex(field.Definition.GetIndex()), string.Format(Messages.ControlBirthNumberMessage, value))); } }
public void ShouldVerifyValidBirthNumbers() { // Birth numnbers randomly generated with http://www.fnrinfo.no/Verktoy/FinnLovlige_Tilfeldig.aspx NorwegianBirthNumber.Verify("19089328341").Should().BeTrue(); NorwegianBirthNumber.Verify("08011129480").Should().BeTrue(); NorwegianBirthNumber.Verify("08063048608").Should().BeTrue(); NorwegianBirthNumber.Verify("01027244536").Should().BeTrue(); NorwegianBirthNumber.Verify("20041622092").Should().BeTrue(); NorwegianBirthNumber.Verify("24015706240").Should().BeTrue(); NorwegianBirthNumber.Verify("08055207438").Should().BeTrue(); NorwegianBirthNumber.Verify("22067937264").Should().BeTrue(); NorwegianBirthNumber.Verify("28090607806").Should().BeTrue(); }
public override bool IsValid(string s) { if (_fieldFormat == StringDataTypeAccountNumber) { return(NorwegianAccountNumber.Verify(s)); } else if (_fieldFormat == StringDataTypeBirthNumber) { return(NorwegianBirthNumber.Verify(s)); } else if (_fieldFormat == StringDataTypeOrganizationNumber) { return(NorwegianOrganizationNumber.Verify(s)); } else { return(true); } }
public void VerifyShouldReturnFalseIfBirthNumberIsNotDigits() { NorwegianBirthNumber.Verify("1234567890A").Should().BeFalse(); NorwegianBirthNumber.Verify("ABCDEFGHIJK").Should().BeFalse(); }