public void Create_Passing_Valid_Values_Returns_Telephone(string prefix, long number)
        {
            var actual = Telephone.Create(prefix, number);

            Assert.AreEqual(prefix, actual.Prefix);
            Assert.AreEqual(number, actual.Number);
        }
        public void IsNull_Passing_Valid_Values_Returns_False(string prefix, long number)
        {
            var expected = false;

            var actual = Telephone.Create(prefix, number);

            Assert.AreEqual(expected, actual.IsNull);
        }
        public void Equals_Passing_Valid_Values_Returns_True(string prefix, long number)
        {
            var left  = Telephone.Create(prefix, number);
            var right = Telephone.Create(prefix, number);

            var isEqual = left.Equals(right);

            Assert.IsTrue(isEqual);
        }
        public void ToString_Passing_Valid_Values_Returns_Value_String_Format(string prefix, long number)
        {
            var expected = $"{prefix} {number}";
            var result   = Telephone.Create(prefix, number);

            var actual = result.ToString();

            Assert.AreEqual(expected, actual);
        }
        public void OperatorNotEqual_Passing_Valid_Values_Returns_True(string prefix, long number)
        {
            var left  = Telephone.Create(prefix, number);
            var right = Telephone.Create("4344", 9999999999);

            var isEqual = left != right;

            Assert.IsTrue(isEqual);
        }
        public void OperatorEqual_Passing_Valid_Distinct_Values_Returns_False(string prefix, long number)
        {
            var left  = Telephone.Create(prefix, number);
            var right = Telephone.Create("4344", 9999999999);

            var isEqual = left == right;

            Assert.IsFalse(isEqual);
        }
        public void Change_Passing_Valid_Values_Returns_Telephone()
        {
            var prefixExpected = "343434F";
            var numberExpected = 9393933333;
            var actual         = Telephone.Create("123", 787687675465468);

            actual.ChangePrefix(prefixExpected).ChangeNumber(numberExpected);

            Assert.AreEqual(prefixExpected, actual.Prefix);
            Assert.AreEqual(numberExpected, actual.Number);
        }
        private void contactTelephoneAddButton_Click(object sender, EventArgs e)
        {
            if (currentPerson == null)
            {
                return;
            }

            string    number    = contactTelephoneTextBox.Text;
            Telephone telephone = Telephone.Create(number, currentPerson.PersonID);

            if (telephone != null)
            {
                contactTelephoneListBox.Items.Add(telephone);

                contactTelephoneTextBox.Text = string.Empty;
            }
            else
            {
                MessageBox.Show("Something went wrong while creating telephone number...", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public void Create_Passing_InvalidOrNull_Value_Returns_ApplicationException(string?prefix, long number)
 {
     Assert.ThrowsException <ApplicationException>(() => Telephone.Create(prefix, number));
 }