コード例 #1
0
    //Method parses SqlString and create object
    public static AccountNr Parse(SqlString s)
    {
        if (s.IsNull)
        {
            return(Null);
        }
        AccountNr accountNr = new AccountNr();

        string[] dane = s.Value.Split(",".ToCharArray());

        if (dane.Length != 1)
        {
            throw new ArgumentException("wprowadz poprawna ilosc argumentów");
        }
        if (accountNr.Validate(dane[0]) == false)
        {
            throw new ArgumentException("wprowadz poprawny AccountNr");
        }

        accountNr._accountNr = dane[0];

        return(accountNr);
    }
コード例 #2
0
        public void TestValidate()
        {
            AccountNr account = new AccountNr();

            Assert.IsFalse(account.Validate("99"));
        }