public void _02_Constructor_ShouldUseTheAccountsOfTheCustomerAsTheSourceForTheListView()
        {
            //Arrange
            Customer customer = new CustomerBuilder().WithId().WithAccounts().Build();

            //Act
            InitializeWindow(customer);

            //Assert
            ICollection <Account> accounts = customer.TryGetAccounts();

            Assert.That(_listView.ItemsSource, Is.SameAs(accounts),
                        "The ItemsSource of the ListView should be the very same list of Accounts of the customer.");
        }
        public void _04_AddAccountButton_Click_AccountServiceSucceeds_ShouldResetUI()
        {
            //Arrange
            Customer customer = new CustomerBuilder().WithId().WithAccounts().Build();

            InitializeWindow(customer);

            _errorTextBlock.Text = "Some previous error message";

            string accountNumber = Guid.NewGuid().ToString();

            _accountNumberTextBox.Text = accountNumber;

            AccountType type = Random.NextAccountType();

            _typeComboBox.SelectedValue = type;

            ICollection <Account> accounts = customer.TryGetAccounts();

            Result successResult = Result.Success();

            _accountServiceMock
            .Setup(service =>
                   service.AddNewAccountForCustomer(It.IsAny <Customer>(), It.IsAny <string>(), It.IsAny <AccountType>()))
            .Returns(successResult).Callback(() =>
            {
                accounts.Add(new AccountBuilder().WithCustomerId(customer.Id).Build());
            });

            //Act
            _addAccountButton.FireClickEvent();

            //Assert
            Assert.That(string.IsNullOrEmpty(_errorTextBlock.Text), Is.True,
                        "The error TextBlock should be empty after the add button is clicked. Any previous error message should be cleared.");

            _accountServiceMock.Verify(service => service.AddNewAccountForCustomer(customer, accountNumber, type), Times.Once,
                                       "The AddNewAccountForCustomer method of the account service is not called correctly.");

            Assert.That(string.IsNullOrEmpty(_accountNumberTextBox.Text), Is.True,
                        "The account TextBox should be cleared after the add succeeds.");

            ItemCollection items = _listView.Items;

            Assert.That(items.Count, Is.EqualTo(accounts.Count),
                        "The 'Items' collection of the ListView should have one account more after the account is added. " +
                        "Tip: try to call the 'Refresh' method on the 'Items' collection to tell WPF that the number of accounts of the customer changed.");
        }