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

            //arrange
            BasicUser basicUser = null;
            string    corePin   = "1010";

            try
            {
                basicUser = new BasicUser(
                    id: 0, pin: new PinVAL(value: corePin),
                    name: new NameVAL(value: "Imię"),
                    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.ChangePin(pin: new PinVAL(value: changePin));
                }
                catch (PinVAL_Exception p_e)
                {
                    result = p_e.What();
                }

                if (result.Equals("OK"))
                {
                    if (basicUser._Pin._Value.Equals(changePin) == false)
                    {
                        result = "Issue with change Pin";
                    }
                }
            }

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