예제 #1
0
        public void CreateBankAccountSuccessfully()
        {
            var content = File.ReadAllText("../../../Fixtures/bank_account_create.json");

            var client = GetMockClient(content);
            var repo   = new BankAccountRepository(client.Object);

            const string userId  = "ec9bf096-c505-4bef-87f6-18822b9dbf2c"; //some user created before
            var          account = new BankAccount
            {
                UserId = userId,
                Active = true,
                Bank   = new Bank
                {
                    BankName      = "Test bank, inc",
                    AccountName   = "Test account",
                    AccountNumber = "8123456789",
                    AccountType   = "savings",
                    Country       = "AUS",
                    HolderType    = "personal",
                    RoutingNumber = "123456"
                }
            };
            var createdAccount = repo.CreateBankAccount(account);

            client.VerifyAll();
            Assert.IsNotNull(createdAccount);
            Assert.IsNotNull(createdAccount.Id);
            Assert.AreEqual("AUD", createdAccount.Currency); // It seems that currency is determined by country
            Assert.IsNotNull(createdAccount.CreatedAt);
            Assert.IsNotNull(createdAccount.UpdatedAt);
            Assert.AreEqual("XXX789", createdAccount.Bank.AccountNumber); //Account number is masked
        }
예제 #2
0
        public void CreateBankAccountSuccessfully()
        {
            var content = File.ReadAllText("../../../Fixtures/bank_account_create.json");

            var client = GetMockClient(content);
            var repo   = new BankAccountRepository(client.Object);

            const string userId  = "ec9bf096-c505-4bef-87f6-18822b9dbf2c"; //some user created before
            var          account = new Dictionary <string, object>
            {
                { "user_id", userId },
                { "active", true },
                { "bank", new Dictionary <string, object>
                  {
                      { "bank_name", "Test bank, inc" },
                      { "account_name", "Test account" },
                      { "account_number", "8123456789" },
                      { "account_type", "savings" },
                      { "country", "AUS" },
                      { "holder_type", "personal" },
                      { "routing_number", "123456" }
                  } }
            };
            var response = repo.CreateBankAccount(account);

            client.VerifyAll();
            var createdAccount = JsonConvert.DeserializeObject <IDictionary <string, object> >(JsonConvert.SerializeObject(response.Values.First()));

            Assert.IsNotNull(createdAccount);
            Assert.IsNotNull(createdAccount["id"]);
            Assert.AreEqual("AUD", (string)createdAccount["currency"]); // It seems that currency is determined by country
            Assert.IsNotNull(createdAccount["created_at"]);
            Assert.IsNotNull(createdAccount["updated_at"]);
            var bank = JsonConvert.DeserializeObject <IDictionary <string, object> >(JsonConvert.SerializeObject(createdAccount["bank"]));

            Assert.AreEqual("XXX789", (string)bank["account_number"]); //Account number is masked
        }