Example #1
0
        public void TestIndividualWithAccount()
        {
            // arrange
            var individual = new Individual("testuser", "*****@*****.**", "hash", "Evgeny", "Shamenv");
            var loginInfo  = new LoginInfo("testprovider", "testkey");

            individual.AddLogin(loginInfo);

            var account = individual.AddAccount("1234567890", "USD");

            account.BankCard = new BankCard("123", "0000", "EVGENY SHMANEV", "1234567890", 12, 2099);

            // act
            var result = (Individual)RunTest(individual, _databaseContext.Customers, x => x.Id);

            // assert
            result.UserName.ShouldBe(individual.UserName);
            result.Email.ShouldBe(individual.Email);
            result.PasswordHash.ShouldBe(individual.PasswordHash);
            result.FirstName.ShouldBe(individual.FirstName);
            result.LastName.ShouldBe(individual.LastName);

            result.Logins.Count().ShouldBe(1);
            result.Logins.First().LoginKey.ShouldBe(loginInfo.LoginKey);
            result.Logins.First().ProviderName.ShouldBe(loginInfo.ProviderName);

            result.Accounts.Count().ShouldBe(1);
            result.Accounts.First().AccountNumber.ShouldBe(account.AccountNumber);
            result.Accounts.First().Currency.ShouldBe(account.Currency);

            result.Accounts.First().BankCard.CardHolder.ShouldBe(account.BankCard.CardHolder);
            result.Accounts.First().BankCard.CardNumber.ShouldBe(account.BankCard.CardNumber);
            result.Accounts.First().BankCard.CsvCode.ShouldBe(account.BankCard.CsvCode);
            result.Accounts.First().BankCard.ExpirationMonth.ShouldBe(account.BankCard.ExpirationMonth);
            result.Accounts.First().BankCard.ExpirationYear.ShouldBe(account.BankCard.ExpirationYear);
            result.Accounts.First().BankCard.PinCode.ShouldBe(account.BankCard.PinCode);
        }