private void InitializeWindow(Customer customer, IAccountRepository accountRepository, IWindowDialogService windowDialogService)
        {
            _window = new AccountsWindow(customer, accountRepository, windowDialogService);
            _window.Show();

            _datagrid          = _window.FindVisualChildren <DataGrid>().FirstOrDefault();
            _addAccountButton  = _window.GetPrivateFieldValueByName <Button>("AddAccountButton");
            _saveAccountButton = _window.GetPrivateFieldValueByName <Button>("SaveAccountButton");
            _transferButton    = _window.GetPrivateFieldValueByName <Button>("TransferButton");
        }
示例#2
0
        private void InitializeWindow(Customer customer)
        {
            _window = new AccountsWindow(customer, _accountRepositoryMock.Object, _accountValidatorMock.Object, _windowDialogServiceMock.Object);
            _window.Show();

            _datagrid          = _window.FindVisualChildren <DataGrid>().FirstOrDefault();
            _addAccountButton  = _window.GetPrivateFieldValueByName <Button>("AddAccountButton");
            _saveAccountButton = _window.GetPrivateFieldValueByName <Button>("SaveAccountButton");
            _transferButton    = _window.GetPrivateFieldValueByName <Button>("TransferButton");
            _errorTextBlock    = _window.GetPrivateFieldValueByName <TextBlock>("ErrorTextBlock");
        }
        private void InitializeWindow(Customer customer)
        {
            _window = new AccountsWindow(customer, _accountServiceMock.Object, _windowDialogServiceMock.Object);
            _window.Show();

            _listView = _window.FindVisualChildren <ListView>().FirstOrDefault();
            Assert.That(_listView, Is.Not.Null, "There should be a ListView defined in the XAML.");
            _newAccountGroupBox = _window.FindVisualChildren <GroupBox>().FirstOrDefault();
            Assert.That(_newAccountGroupBox, Is.Not.Null, "There should be a GroupBox defined in the XAML.");

            //AccountNumberTextBox
            _accountNumberTextBox = _window.GetPrivateFieldValueByName <TextBox>("AccountNumberTextBox");
            Assert.That(_accountNumberTextBox, Is.Not.Null, "There should be a TextBox with the name AccountNumberTextBox.");

            _typeComboBox = _window.FindVisualChildren <ComboBox>().FirstOrDefault();
            Assert.That(_typeComboBox, Is.Not.Null, "There should be a ComboBox defined in the XAML.");

            _addAccountButton = _window.GetPrivateFieldValueByName <Button>("AddAccountButton");
            Assert.That(_addAccountButton, Is.Not.Null, "There should be a Button with the name AddAccountButton.");
            _errorTextBlock = _window.GetPrivateFieldValueByName <TextBlock>("ErrorTextBlock");
            Assert.That(_errorTextBlock, Is.Not.Null, "There should be a TextBlock with the name ErrorTextBlock.");
        }