public void ValidateSSN2(string arg, bool expected)
        {
            PersonWindow pw     = new PersonWindow(null);
            bool         result = pw.ValidateSocialSecurityNumber(arg);

            Assert.AreEqual(expected, result);
        }
        public void ValidateNameTest()
        {
            PersonWindow pw     = new PersonWindow(null);
            bool         result = pw.ValidateName("Jack Gates");

            Assert.AreEqual(true, result);
        }
        public void ValidateDate1(string arg, bool expected)
        {
            PersonWindow pw     = new PersonWindow(null);
            bool         result = pw.ValidateDate(arg);

            Assert.AreEqual(expected, result);
        }
        public void ValidateSocialSecurityNumberTest()
        {
            PersonWindow pw     = new PersonWindow(null);
            bool         result = pw.ValidateSocialSecurityNumber("123 456 789");

            Assert.AreEqual(true, result);
        }
        public void ValidateDateTest()
        {
            PersonWindow pw     = new PersonWindow(null);
            bool         result = pw.ValidateDate("2020-02-02 08:00");

            Assert.AreEqual(false, result);
        }
Ejemplo n.º 6
0
 public NavigationModel(MainWindow mainWindow)
 {
     _mainWindow   = mainWindow;
     _personWindow = new PersonWindow();
     _tableView    = new TableView();
     _personView   = new PersonView();
 }
Ejemplo n.º 7
0
        private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var grid         = (DataGridRow)sender;
            var personWindow = new PersonWindow((int)comboBoxLocales.SelectedItem, (Person)grid.DataContext);

            personWindow.ShowDialog();
        }
Ejemplo n.º 8
0
        private void EditPerson(object obj)
        {
            var personWindow = new PersonWindow((int)locale, (Person)obj);

            personWindow.ShowDialog();

            RefreshGrid(PageSize, Page, (int)Locale, Search);
        }
Ejemplo n.º 9
0
        public void NameIsValidTest()
        {
            PersonWindow pw       = new PersonWindow(null);
            string       name     = Convert.ToString(TestContext.DataRow["Name"].ToString());
            bool         expected = Convert.ToBoolean(TestContext.DataRow["Expected"].ToString());
            bool         result   = pw.NameIsValid(name);

            Assert.AreEqual(expected, result);
        }
        public void ValidateDate2()
        {
            PersonWindow pw       = new PersonWindow(null);
            string       arg      = Convert.ToString(TestContext.DataRow["Date"].ToString());
            bool         expected = Convert.ToBoolean(TestContext.DataRow["Expected"].ToString());
            bool         result   = pw.ValidateDate(arg);

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 11
0
        public void SocialSecurityNumberIsValid()
        {
            PersonWindow pw       = new PersonWindow(null);
            string       ssn      = Convert.ToString(TestContext.DataRow["ssn"].ToString());
            bool         expected = Convert.ToBoolean(TestContext.DataRow["expected"].ToString());
            bool         result   = pw.SocialSecurityNumberIsValid(ssn);

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 12
0
 public void OpenWindow(BaseViewModel context)
 {
     if (!_windows.ContainsKey(context))
     {
         PersonWindow window = new PersonWindow();
         window.DataContext = context;
         window.Show();
         _windows.Add(context, window);
     }
 }
Ejemplo n.º 13
0
        public void ShowAddUserDialog()
        {
            Console.Out.WriteLine("Add dialog");
            PersonWindow pw = new PersonWindow(this)
            {
                Owner = _owner, Title = "Add user"
            };

            pw.ShowDialog();
        }
Ejemplo n.º 14
0
        public void ShowEditUserDialog()
        {
            Console.Out.WriteLine("Edit dialog");
            PersonWindow pw = new PersonWindow(this, SelectedPerson)
            {
                Owner = _owner, Title = "Edit user"
            };

            pw.ShowDialog();
        }
Ejemplo n.º 15
0
        private static void ExecuteBindableViewModel()
        {
            var window = new PersonWindow {
                DataContext = new BindablePerson()
                {
                    Name = "rimever"
                }
            };

            window.Show();
            window.Close();
        }
Ejemplo n.º 16
0
        public void BindingAssert()
        {
            var window = new PersonWindow {
                DataContext = new PersonViewModel(new Person()
                {
                    Name = "rimever"
                })
            };

            window.Show();
            window.Close();
            GC.Collect();
            dotMemory.Check(memory =>
                            Assert.AreEqual(0, memory.GetObjects(where => where.Type.Is <PersonViewModel>()).ObjectsCount));
        }
Ejemplo n.º 17
0
        private static void ExecuteWeakPersonViewModel()
        {
            var p = new Person()
            {
                Name = "rim"
            };

            foreach (var _ in Enumerable.Range(0, 2))
            {
                var window = new PersonWindow {
                    DataContext = new WeakPersonViewModel(p)
                };
                window.Show();
                window.Close();
                window = null;
            }
        }
Ejemplo n.º 18
0
        public void PersonWindowTest()
        {
            Person dPerson = new Person(1, "Ivanov", "Ivan", "Ivanovich", new DateTime(1995, 1, 1),
                                        new Sex(1, "Male"), new Locality(1, "Moscow"), new Locality(10, "Voronezh"), "+79066666666");

            dPerson.Hobbies.Add(new Hobby(1, "TestHobby"));

            Person dFriendPerson = new Person(1, "Sidorov", "Petr", "Ivanovich", new DateTime(1995, 1, 1),
                                              new Sex(1, "Male"), new Locality(1, "Moscow"), new Locality(10, "Voronezh"), "+79066666667");

            dPerson.LFriends.Add(dFriendPerson);
            dPerson.RFriends.Add(dFriendPerson);

            PersonWindowViewModel vm     = new PersonWindowViewModel(dPerson);
            PersonWindow          window = new PersonWindow();

            window.DataContext = vm;
            window.ShowDialog();
        }
Ejemplo n.º 19
0
        public PersonWindowViewModel(PersonWindow pw, MainWindowViewModel m, Person p)
        {
            ProceedCommand = new ProceedCommand(this);
            _mwvm          = m;
            _pw            = pw;

            if (p != null)
            {
                _person        = p;
                FirstNameValue = p.Name;
                LastNameValue  = p.Surname;
                DateValue      = p.BirthDate;
                EMailValue     = p.EMail;
            }
            else
            {
                DateValue = new DateTime(2000, 1, 1);
            }
        }
Ejemplo n.º 20
0
        public void Navigate(ViewsEnum view)
        {
            switch (view)
            {
            case ViewsEnum.Table:

                _mainWindow.ContentControl.Content = _tableView;
                break;

            case ViewsEnum.AddView:

                if (!_personWindow.IsActive)
                {
                    _personWindow = new PersonWindow();
                    _personWindow.Show();
                    _personWindow.ContentControl.Content = _personView;
                }

                break;

            case ViewsEnum.EditView:

                if (!_personWindow.IsActive && (UpdateManager.Instance._tableViewModel.EditedPerson != null))
                {
                    _personWindow = new PersonWindow();

                    _personView = new PersonView(UpdateManager.Instance._tableViewModel.EditedPerson, ViewsEnum.EditView);
                    _personWindow.ContentControl.Content = _personView;
                    _personWindow.Show();
                }

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(view), view, null);
            }
        }
Ejemplo n.º 21
0
 private void ButtonAdd_Click(object sender, RoutedEventArgs e)
 {
     PersonWindow.Run(_viewModel.PersonViewModel);
 }
Ejemplo n.º 22
0
        private void MenuPerson_OnClick(object sender, RoutedEventArgs e)
        {
            var win = new PersonWindow();

            win.Show();
        }