Exemplo n.º 1
0
        private void InitializeWindow(ICustomerRepository customerRepository, ICityRepository cityRepository, IWindowDialogService windowDialogService)
        {
            _window = new CustomersWindow(customerRepository, cityRepository, windowDialogService);
            _window.Show();

            _datagrid           = _window.FindVisualChildren <DataGrid>().FirstOrDefault();
            _addCustomerButton  = _window.GetPrivateFieldValueByName <Button>("AddCustomerButton");
            _saveCustomerButton = _window.GetPrivateFieldValueByName <Button>("SaveCustomerButton");
            _showAccountsButton = _window.GetPrivateFieldValueByName <Button>("ShowAccountsButton");
        }
        private void InitializeWindow()
        {
            _window = new CustomersWindow(_customerRepositoryMock.Object, _customerValidatorMock.Object, _cityRepositoryMock.Object, _windowDialogServiceMock.Object);
            _window.Show();

            _datagrid           = _window.FindVisualChildren <DataGrid>().FirstOrDefault();
            _addCustomerButton  = _window.GetPrivateFieldValueByName <Button>("AddCustomerButton");
            _saveCustomerButton = _window.GetPrivateFieldValueByName <Button>("SaveCustomerButton");
            _showAccountsButton = _window.GetPrivateFieldValueByName <Button>("ShowAccountsButton");
            _errorTextBlock     = _window.GetPrivateFieldValueByName <TextBlock>("ErrorTextBlock");
        }
        private void InitializeWindow()
        {
            _window = new CustomersWindow(_customerRepositoryMock.Object, _cityRepositoryMock.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.");
            _cityComboBox = _window.FindVisualChildren <ComboBox>().FirstOrDefault();
            Assert.That(_cityComboBox, Is.Not.Null, "There should be a ComboBox defined in the XAML.");
            _newCustomerGroupBox = _window.FindVisualChildren <GroupBox>().FirstOrDefault();
            Assert.That(_newCustomerGroupBox, Is.Not.Null, "There should be a GroupBox defined in the XAML.");
            _addCustomerButton = _window.GetPrivateFieldValueByName <Button>("AddCustomerButton");
            Assert.That(_addCustomerButton, Is.Not.Null, "There should be a Button with the name AddCustomerButton.");
            _errorTextBlock = _window.GetPrivateFieldValueByName <TextBlock>("ErrorTextBlock");
            Assert.That(_errorTextBlock, Is.Not.Null, "There should be a TextBlock with the name ErrorTextBlock.");
        }
        private void ViewCustomers_Click(object sender, RoutedEventArgs e)
        {
            CustomersWindow cs = new CustomersWindow();

            cs.Show();
        }
        private void CustomersManagement()
        {
            CustomersWindow myWindow = new CustomersWindow();

            myWindow.Show();
        }