Пример #1
0
        public void TestUpdateClient()
        {
            var clientGuid = Guid.NewGuid();
            var client     = new Client
            {
                Guid     = clientGuid,
                Login    = "******",
                Password = "******"
            };

            DbClientWorker.AddClient(client);

            var getClient = DbClientWorker.GetClient(clientGuid);

            Assert.IsNotNull(getClient);

            getClient.Login    = "******";
            getClient.Password = "******";
            DbClientWorker.UpdateClient(getClient);

            var updatedClient = DbClientWorker.GetClient(clientGuid);

            Assert.IsNotNull(getClient);
            Assert.AreEqual(getClient.Login, "nigoLtseTtinU");
            Assert.AreEqual(getClient.Password, "drowssaPtseTtinU");

            DbClientWorker.DeleteClient(clientGuid);
        }
Пример #2
0
        public void TestGetClient()
        {
            var clientGuid = Guid.NewGuid();
            var client     = new Client
            {
                Guid     = clientGuid,
                Login    = "******",
                Password = "******"
            };

            DbClientWorker.AddClient(client);
            var getClient = DbClientWorker.GetClient(clientGuid);

            Assert.IsNotNull(getClient);
            DbClientWorker.DeleteClient(clientGuid);
        }
Пример #3
0
        private void SignUpBtn_Click(object sender, RoutedEventArgs e)
        {
            //TODO: Создание нового клиента

            try
            {
                CheckInputs();

                var login          = LoginTxt.Text;
                var password       = PasswordTxt.Password;
                var passwordRepeat = PasswordRepeatTxt.Password;
                var email          = EmailTxt.Text;
                var phone          = PhoneTxt.Text;

                if (DbClientWorker.CheckClient(login))
                {
                    throw new Exception("Логин \"" + login + "\" уже существует");
                }

                var client = new Client
                {
                    Guid     = Guid.NewGuid(),
                    Login    = login,
                    Password = password,
                    Email    = email,
                    Phone    = phone
                };

                DbClientWorker.AddClient(client);

                if (RegisterEnded != null)
                {
                    RegisterEnded(this, new EventArgs());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }