Beispiel #1
0
        public void BasicUser_When_Change_Name(string changeName, string expected)
        {
            string result = "OK";

            //arrange
            BasicUser basicUser = null;
            string    coreName  = "Imię";

            try
            {
                basicUser = new BasicUser(
                    id: 0, pin: new PinVAL(value: "1010"),
                    name: new NameVAL(value: coreName),
                    surname: new SurnameVAL(value: "Nazwisko"),
                    bankAccount: new BankAccount(
                        state: new MoneyVAL(value: 200.0M,
                                            currency: Currency.PLN)));
            }
            catch (PinVAL_Exception p_e)
            {
                result = p_e.What();
            }
            catch (NameVAL_Exception n_e)
            {
                result = n_e.What();
            }
            catch (SurnameVAL_Exception s_e)
            {
                result = s_e.What();
            }
            catch (BankAccount_Exception b_e)
            {
                result = b_e.What();
            }
            catch (MoneyVAL_Exception m_e)
            {
                result = m_e.What();
            }

            //act
            if (result.Equals("OK"))
            {
                try
                {
                    basicUser.ChangeName(name: new NameVAL(value: changeName));
                }
                catch (NameVAL_Exception n_e)
                {
                    result = n_e.What();
                }

                if (result.Equals("OK"))
                {
                    if (basicUser._Name._Value.Equals(changeName) == false)
                    {
                        result = "Issue with change name";
                    }
                }
            }

            //assert
            Assert.AreEqual(expected: expected, actual: result);
        }