public void Account_Name_Must_AlphaNumeric()
 {
     var account = new BankAccount(NUMBER, SORTCODE, NAME);
     Assert.Equal(NAME, account.Name);
 }
                public void Valid_Data(string number, string expected, Bank bank)
                {
                    var account = new BankAccount(number, SORTCODE, NAME, bank);

                    var serialize = account.Serialize(SerializeMethod.FixedWidth);

                    Assert.Equal(expected, serialize.Number);
                }
                public void SixDigits()
                {
                    var account = new BankAccount(NUMBER, SORTCODE, NAME);

                    var serialize = account.Serialize(SerializeMethod.FixedWidth);

                    Assert.Equal(SORTCODE, serialize.SortCode);
                }
                public void Default()
                {
                    var account = new BankAccount(BankAccountTest.NUMBER,
                            BankAccountTest.SORTCODE, BankAccountTest.NAME);

                    var serialize = account.Serialize(SerializeMethod.FixedWidth);

                    var composed = serialize.SortCode + serialize.Number + serialize.Name;

                    Assert.Equal(composed, serialize.Line);
                }
                public void Properties(string prop1, string prop2, string prop3)
                {
                    var properties = new [] { prop1, prop2, prop3 };

                    var account = new BankAccount(BankAccountTest.NUMBER,
                            BankAccountTest.SORTCODE, BankAccountTest.NAME);

                    var serialize = account.Serialize(SerializeMethod.FixedWidth, properties);

                    var composed = "";
                    foreach(var prop in properties)
                    {
                        var p = typeof(ISerializedAccount).GetProperty(prop);
                        composed += p.GetValue(serialize, null).ToString();
                    }

                    Assert.Equal(composed, serialize.Line);
                }
 public void All_Banks_6_Eight_Digits(string number)
 {
     var account = new BankAccount(number, SORTCODE, NAME, Bank.Natwest);
     Assert.Equal(number, account.Number);
     Assert.Equal(Bank.Natwest, account.Bank);
 }
                public void Configuration()
                {
                    var configuration = new DirectDebitConfiguration();
                    configuration.BankAccount.Add(new FieldConfiguration { Field = "Number" });

                    var account = new BankAccount(BankAccountTest.NUMBER,
                            BankAccountTest.SORTCODE, BankAccountTest.NAME);

                    var serialize = account.Serialize(SerializeMethod.FixedWidth, configuration);

                    Assert.Equal(serialize.Number, serialize.Line);
                }
                public void Long_Names_Truncate()
                {
                    var longname = "Mr Bob Johnny Martin Horrocks III";
                    var account = new BankAccount(NUMBER, SORTCODE, longname);
                    var serialize = account.Serialize(SerializeMethod.FixedWidth);

                    Assert.Equal("MR BOB JOHNNY MART", serialize.Name);
                }
                public void Short_Name_Pad()
                {
                    var shortname = "Bob";
                    var account = new BankAccount(NUMBER, SORTCODE, shortname);
                    var serialize = account.Serialize(SerializeMethod.FixedWidth);

                    Assert.Equal("BOB               ", serialize.Name);
                }
Esempio n. 10
0
            public void Different_Bank_Account()
            {
                var account1 = new BankAccount("87654321", SORTCODE, NAME);
                var account2 = new BankAccount(NUMBER, SORTCODE, NAME);

                Assert.NotEqual(account1, account2);
            }
Esempio n. 11
0
            public void Match_On_Bank_Account_And_SORTCODE()
            {
                var account1 = new BankAccount(NUMBER, SORTCODE, NAME);
                var account2 = new BankAccount(NUMBER, SORTCODE, NAME);

                Assert.Equal(account1, account2);
            }
Esempio n. 12
0
            public void Difference_Sort_Code()
            {
                var account1 = new BankAccount(NUMBER, SORTCODE, NAME);
                var account2 = new BankAccount(NUMBER, "654321", NAME);

                Assert.NotEqual(account1, account2);
            }
Esempio n. 13
0
            public void Account_Name_Irrelevant()
            {
                var account1 = new BankAccount(NUMBER, SORTCODE, "Another Account Name");
                var account2 = new BankAccount(NUMBER, SORTCODE, NAME);

                Assert.Equal(account1, account2);
            }
Esempio n. 14
0
            public void Valid_Banks_For_Ten_Number(Bank bank)
            {
                var number = "1324567890";
                var account = new BankAccount(number, SORTCODE, NAME, bank);

                Assert.Equal(number, account.Number);
                Assert.Equal(bank, account.Bank);
            }
Esempio n. 15
0
 public void Number_Must_Be_Six_To_Eight_Digits(string number)
 {
     var account = new BankAccount(number, SORTCODE, NAME);
     Assert.Equal(number, account.Number);
 }
Esempio n. 16
0
                public void Uppercase()
                {
                    var account = new BankAccount(NUMBER, SORTCODE, NAME);

                    var serialize = account.Serialize(SerializeMethod.FixedWidth);

                    Assert.True(Regex.IsMatch(serialize.Name, @"^[A-Z\s]+$"));
                }
Esempio n. 17
0
 public void SortCode_Must_Be_Six_Digits()
 {
     var account = new BankAccount(NUMBER, SORTCODE, NAME);
     Assert.Equal(SORTCODE, account.SortCode);
 }
Esempio n. 18
0
 public void Valid_Special_Chars(string name)
 {
     var account = new BankAccount(NUMBER, SORTCODE, name);
     Assert.Equal(name, account.Name);
 }