public void CantCreateHumanHolderWithJustFirstName()
        {
            // Arrange
            string firstName = "Testing";

            // Act
            HumanAcccountHolder hah = new HumanAcccountHolder("TestingUser", "TestPass", new string[] { firstName });
        }
示例#2
0
        public void CantCreateNegativeBalanceAccount()
        {
            // Arrange
            Currency fakeCurrency = new Currency(1d, "fakemonies", '!');
            HumanAcccountHolder hah = new HumanAcccountHolder("TestUser", "TestPass", new string[] { "First", "middle1", "middle2", "Last" });

            // Act
            Account acctDefault = new Account(hah,0d,-200d, fakeCurrency);
        }
        public void CanCreateJsonDal()
        {
            // Arrange
            JsonFileAccessLayer fal = new JsonFileAccessLayer("C:\\testAcct.act");
            HumanAcccountHolder hah = new HumanAcccountHolder("TestUser", "TestPass", new string[] { "Test", "McTester" });
            Account act = new Account(hah, 0d, 0d, new Currency(1d, "fakemonies", '!'));

            // Act
            fal.SaveAccount(act);
        }
示例#4
0
        public void CanCreateZeroBalanceAccount()
        {
            // Arrange
            HumanAcccountHolder hah = new HumanAcccountHolder("TestUser", "TestPass", new string[] { "First", "middle1", "middle2", "Last" });
            Currency fakeCurrency = new Currency(1d, "fakemonies", '!');

            // Act
            Account acctManual = new Account(hah,0d,0d,fakeCurrency);

            // Assert
            Assert.AreEqual(0.0d, acctManual.Balance.ObjectiveValue);
        }
示例#5
0
        public void NegativeBalancesSufferPenalties()
        {
            // Arrange
            HumanAcccountHolder hah = new HumanAcccountHolder("TestUser", "TestPass", new string[] { "First", "middle1", "middle2", "Last" });
            Currency fakeCurrency =  new Currency(1d, "fakemonies", '!');
            // Act

            Account acctDefault = new Account(hah, 50d, 200d, fakeCurrency);
            Transaction bigWithdrawal = new Transaction("Test over withdrawal", new Money(-400d,fakeCurrency), TransactionTypes.Withdrawal);
            acctDefault.PerformTransaction(bigWithdrawal);

            // Assert
            Assert.AreEqual(-250d, acctDefault.Balance.Value);
        }
        public void CanCreateHumanHolderWithFirstLastandMiddleNames()
        {
            // Arrange
            string[] Names = new string[]{"Tester","The","Test","McTest"};

            // Act
            HumanAcccountHolder hah = new HumanAcccountHolder("TestingUser", "TestPass", Names);

            // Assert
            Assert.AreEqual("Tester", hah.FirstName);
            Assert.AreEqual("McTest", hah.LastName);
            Assert.AreEqual(hah.MiddleNames[0], "The");
            Assert.AreEqual(hah.MiddleNames[1], "Test");
            Assert.AreEqual("Tester The Test McTest", hah.DisplayName);
            Assert.AreEqual("TestingUser", hah.UserName);
        }
        public void CanCreateHumanHolderWithFirstAndLastName()
        {
            // Arrange
            string firstName = "Tester";
            string lastName = "McTest";
            string[] middleNames = new string[0];

            // Act
            HumanAcccountHolder hah = new HumanAcccountHolder("TestingUser", "TestPass", new string[] { firstName, lastName });

            // Assert
            Assert.AreEqual("Tester", hah.FirstName);
            Assert.AreEqual("McTest", hah.LastName);
            Assert.AreEqual(hah.MiddleNames.Length, 0);
            Assert.AreEqual("Tester McTest", hah.DisplayName);
            Assert.AreEqual("TestingUser", hah.UserName);
        }