public void ICanRegisterMoreThanOneDirectDebitInitiationContract() { Creditor creditor = new Creditor("G35008770", "Real Club Náutico de Gran Canaria"); BankCode bankCode = new BankCode("2038", "Bankia, S.A.", "CAHMESMMXXX"); CreditorAgent creditorAgent = new CreditorAgent(bankCode); BankAccount creditorAccount = new BankAccount(new ClientAccountCodeCCC("20381111401111111111")); DirectDebitInitiationContract directDebitInitiationContract = new DirectDebitInitiationContract( creditorAccount, creditor.NIF, "777", creditorAgent); creditor.AddDirectDebitInitiacionContract(directDebitInitiationContract); BankCode bankCode2 = new BankCode("2100", "CaixaBank, S.A.", "CAIXESBBXXX"); CreditorAgent creditorAgent2 = new CreditorAgent(bankCode2); BankAccount creditorAccount2 = new BankAccount(new ClientAccountCodeCCC("21001111301111111111")); DirectDebitInitiationContract directDebitInitiationContract2 = new DirectDebitInitiationContract( creditorAccount2, creditor.NIF, "333", creditorAgent2); creditor.AddDirectDebitInitiacionContract(directDebitInitiationContract2); Assert.AreEqual("20381111401111111111", creditor.DirectDebitInitiationContracts["777"].CreditorAcount.CCC.CCC); Assert.AreEqual("CAHMESMMXXX", creditor.DirectDebitInitiationContracts["777"].CreditorAgent.BankBIC); Assert.AreEqual("777", creditor.DirectDebitInitiationContracts["777"].CreditorBussinessCode); Assert.AreEqual("ES90777G35008770", creditor.DirectDebitInitiationContracts["777"].CreditorID); Assert.AreEqual("21001111301111111111", creditor.DirectDebitInitiationContracts["333"].CreditorAcount.CCC.CCC); Assert.AreEqual("CAIXESBBXXX", creditor.DirectDebitInitiationContracts["333"].CreditorAgent.BankBIC); Assert.AreEqual("333", creditor.DirectDebitInitiationContracts["333"].CreditorBussinessCode); Assert.AreEqual("ES90333G35008770", creditor.DirectDebitInitiationContracts["333"].CreditorID); }
public void ANewCreditorAgentIsCorrectlyCreated() { BankCode bankCode = new BankCode("2038", "Bankia, S.A.", "CAHMESMMXXX"); CreditorAgent creditAgent = new CreditorAgent(bankCode); Assert.AreEqual("2038",creditAgent.LocalBankCode); Assert.AreEqual("Bankia, S.A.", creditAgent.BankName); Assert.AreEqual("CAHMESMMXXX", creditAgent.BankBIC); }
public void GivenIHaveADirectDebitInitiationContractRegisteredWithBussinesCode(string creditorBussinessCode) { Creditor creditor = (Creditor)ScenarioContext.Current["Creditor"]; BankCode bankCode = new BankCode("2100", "CaixaBank, S.A.", "CAIXESBBXXX"); CreditorAgent creditorAgent = new CreditorAgent(bankCode); BankAccount creditorAccount = new BankAccount(new ClientAccountCodeCCC("21001111301111111111")); DirectDebitInitiationContract directDebitInitiationContract = new DirectDebitInitiationContract( creditorAccount, creditor.NIF, "333", creditorAgent); creditor.AddDirectDebitInitiacionContract(directDebitInitiationContract); }
public void GivenIHaveADirectDebitInitiationContract() { Creditor creditor = (Creditor)ScenarioContext.Current["Creditor"]; BankCode bankCode = new BankCode("2100", "CaixaBank, S.A.", "CAIXESBBXXX"); CreditorAgent creditorAgent = new CreditorAgent(bankCode); BankAccount creditorAccount = new BankAccount(new ClientAccountCodeCCC("21001111301111111111")); DirectDebitInitiationContract directDebitInitiationContract = new DirectDebitInitiationContract( creditorAccount, creditor.NIF, "333", creditorAgent); ScenarioContext.Current.Add("Contract333", directDebitInitiationContract); }
public void ANewDirectDebitInitiationContractIsCorrectlyCreated() { Creditor creditor = new Creditor("G35008770", "Real Club Náutico de Gran Canaria"); BankAccount creditorAccount = new BankAccount(new ClientAccountCodeCCC("20381111401111111111")); BankCode bankCode = new BankCode("2038", "Bankia, S.A.", "CAHMESMMXXX"); CreditorAgent creditorAgent = new CreditorAgent(bankCode); DirectDebitInitiationContract directDebitInitiationContract = new DirectDebitInitiationContract( creditorAccount, creditor.NIF, "777", creditorAgent); Assert.AreEqual("20381111401111111111", directDebitInitiationContract.CreditorAcount.CCC.CCC); Assert.AreEqual("CAHMESMMXXX", directDebitInitiationContract.CreditorAgent.BankBIC); Assert.AreEqual("777", directDebitInitiationContract.CreditorBussinessCode); Assert.AreEqual("ES90777G35008770", directDebitInitiationContract.CreditorID); }
public void BankCodesWithDuplicatedValuesInLocalBankCodeOrBICAreNotAdded() { BankCodes bankCodesEmpty = new BankCodes(); List<BankCode> banksList = new List<BankCode>(); banksList.Add(new BankCode("0128", "BANKINTER, S.A.", "BKBKESMMXXX")); banksList.Add(new BankCode("2100", "CAIXABANK, S.A.", "CAIXESBBXXX")); bankCodesEmpty.AddBankCodesToDictionaries(banksList); Assert.AreEqual(2, bankCodesEmpty.BankDictionaryByBIC.Count); List<BankCode> listOfBanksToAdd = new List<BankCode>(); BankCode bankWithDuplicatedLocalBankCode = new BankCode("0128", "DUPLICATED LOCAL BANK CODE", "DBNKCMMXXX"); BankCode bankWithDuplicatedBIC = new BankCode("9009", "DUPLICATED BIC", "CAIXESBBXXX"); BankCode corrrectBank = new BankCode("0156", "THE ROYAL BANK OF SCOTLAND PLC, SUCURSAL EN ESPAÑA.", "ABNAESMMXXX"); listOfBanksToAdd.Add(bankWithDuplicatedLocalBankCode); listOfBanksToAdd.Add(bankWithDuplicatedBIC); listOfBanksToAdd.Add(corrrectBank); bankCodesEmpty.AddBankCodesToDictionaries(listOfBanksToAdd); Assert.AreEqual(3, bankCodesEmpty.BankDictionaryByBIC.Count); Assert.AreEqual("BKBKESMMXXX", bankCodesEmpty.BankDictionaryByLocalBankCode["0128"].BankBIC); Assert.AreEqual("ABNAESMMXXX", bankCodesEmpty.BankDictionaryByLocalBankCode["0156"].BankBIC); }
public void GivenMyDirectDebitInitiationContractIs(Table contractTable) { Creditor creditor = new Creditor(contractTable.Rows[0]["NIF"], contractTable.Rows[0]["Name"]); BankCode creditorAgentBankCode = new BankCode( contractTable.Rows[0]["LocalBankCode"], contractTable.Rows[0]["CreditorAgentName"], contractTable.Rows[0]["BIC"]); CreditorAgent creditorAgent = new CreditorAgent(creditorAgentBankCode); BankAccount creditorAccount = new BankAccount(new InternationalAccountBankNumberIBAN(contractTable.Rows[0]["CreditorAccount"])); string creditorBussinessCode = contractTable.Rows[0]["CreditorBussinesCode"]; DirectDebitInitiationContract directDebitContract = new DirectDebitInitiationContract( creditorAccount, creditor.NIF, contractTable.Rows[0]["CreditorBussinesCode"], creditorAgent); ScenarioContext.Current.Add("Creditor", creditor); ScenarioContext.Current.Add("CreditorAgent", creditorAgent); ScenarioContext.Current.Add("DirectDebitInitiationContract", directDebitContract); }
public void GivenIHaveACreditorAgent() { BankCode bankCode = new BankCode("2038", "Bankia, S.A.", "CAHMESMMXXX"); CreditorAgent creditorAgent = new CreditorAgent(bankCode); ScenarioContext.Current.Add("CreditorAgent", creditorAgent); }
public void GivenIHaveABank() { BankCode bankCode = new BankCode("2038", "Bankia, S.A.", "CAHMESMMXXX"); ScenarioContext.Current.Add("BankCode", bankCode); }
public void WhenIRegisterASecondContractData() { Creditor creditor = (Creditor)ScenarioContext.Current["Creditor"]; BankCode bankCode = new BankCode("2038", "Bankia, S.A.", "CAHMESMMXXX"); CreditorAgent creditorAgent = new CreditorAgent(bankCode); BankAccount creditorAccount = new BankAccount(new ClientAccountCodeCCC("20381111401111111111")); DirectDebitInitiationContract directDebitInitiationContract = new DirectDebitInitiationContract( creditorAccount, creditor.NIF, "777", creditorAgent); creditor.AddDirectDebitInitiacionContract(directDebitInitiationContract); }
public void ICanRemoveADirectDebitContract() { Creditor creditor = new Creditor("G35008770", "Real Club Náutico de Gran Canaria"); BankCode bankCode = new BankCode("2038", "Bankia, S.A.", "CAHMESMMXXX"); CreditorAgent creditorAgent = new CreditorAgent(bankCode); BankAccount creditorAccount = new BankAccount(new ClientAccountCodeCCC("20381111401111111111")); DirectDebitInitiationContract directDebitInitiationContract = new DirectDebitInitiationContract( creditorAccount, creditor.NIF, "777", creditorAgent); creditor.AddDirectDebitInitiacionContract(directDebitInitiationContract); creditor.RemoveDirectDebitInitiacionContract("777"); Assert.IsFalse(creditor.DirectDebitInitiationContracts.ContainsKey("777")); }
public void TheCreditorAccountForADirectDebitContractCanBeChanged() { Creditor creditor = new Creditor("G35008770", "Real Club Náutico de Gran Canaria"); BankCode bankCode = new BankCode("2038", "Bankia, S.A.", "CAHMESMMXXX"); CreditorAgent creditorAgent = new CreditorAgent(bankCode); BankAccount creditorAccount = new BankAccount(new ClientAccountCodeCCC("20381111401111111111")); DirectDebitInitiationContract directDebitInitiationContract = new DirectDebitInitiationContract( creditorAccount, creditor.NIF, "777", creditorAgent); creditor.AddDirectDebitInitiacionContract(directDebitInitiationContract); BankAccount newCreditorAccount = new BankAccount(new ClientAccountCodeCCC("20382222102222222222")); creditor.ChangeDirectDebitContractAccount("777", newCreditorAccount); Assert.AreEqual("20382222102222222222", creditor.DirectDebitInitiationContracts["777"].CreditorAcount.CCC.CCC); }
public void OnlyCanChangeDirectDebitContractAccountsWithAccountsFromTheSameCreditorAgent() { Creditor creditor = new Creditor("G35008770", "Real Club Náutico de Gran Canaria"); BankCode bankCode = new BankCode("2038", "Bankia, S.A.", "CAHMESMMXXX"); CreditorAgent creditorAgent = new CreditorAgent(bankCode); BankAccount creditorAccount = new BankAccount(new ClientAccountCodeCCC("20381111401111111111")); DirectDebitInitiationContract directDebitInitiationContract = new DirectDebitInitiationContract( creditorAccount, creditor.NIF, "777", creditorAgent); BankAccount newBankAccount = new BankAccount(new ClientAccountCodeCCC("21001111301111111111")); try { directDebitInitiationContract.ChangeCreditorBank(newBankAccount); } catch (ArgumentException exception) { Assert.AreEqual("The new account must be from the same Creditor Agent", exception.GetMessageWithoutParamName()); throw exception; } }