private static bool StartOrContinuRegisteringDependencies() { // todo: don't retry indefinately // todo: don't wait indefinately for external code (use ask based implementation) // todo: make sure no registration has the same order ( * 1000 + counter) // these points will weigh more heavily once external plugins are made and used var failedRegistrations = new List <Tuple <IUwebshopAddon, IDependencyRegistration, Exception> >(); foreach (var registration in _addons.Value.SelectMany(a => a.GetDependencyRegistrations().Select(dr => new { Addon = a, DependencyRegistration = dr })).Where(d => d.DependencyRegistration.Order() > FinishedRegistrationLevel).OrderBy(d => d.DependencyRegistration.Order())) { var control = new RegistrationControl(_iocContainer); try { registration.DependencyRegistration.Register(control); // never trust external code } catch (Exception e) { failedRegistrations.Add(new Tuple <IUwebshopAddon, IDependencyRegistration, Exception>(registration.Addon, registration.DependencyRegistration, e)); throw; } if (control.NotNowCalled) { return(true); } FinishedRegistrationLevel = registration.DependencyRegistration.Order(); } foreach (var registration in failedRegistrations) { // possible todo: redo registration without failed addon (at least don't call initialization on that addon) Log.Instance.LogError(registration.Item3, "Failed registering addon " + registration.Item1.Name() + " on part " + registration.Item2.Description()); } return(false); }
public void validatecomboBox2Test() { Library _libr = null; // TODO: Initialize to an appropriate value RegistrationControl target = new RegistrationControl(_libr); // TODO: Initialize to an appropriate value string age = "1990"; // TODO: Initialize to an appropriate value bool expected = true; // TODO: Initialize to an appropriate value bool actual; actual = target.validatecomboBox2(age); Assert.AreEqual(expected, actual); }
public void ComputeStringMD5HashTest() { Library _libr = null; // TODO: Initialize to an appropriate value RegistrationControl target = new RegistrationControl(_libr); // TODO: Initialize to an appropriate value string instr = "TEST"; // TODO: Initialize to an appropriate value string expected = target.ComputeStringMD5Hash("TEST"); // TODO: Initialize to an appropriate value string actual; actual = target.ComputeStringMD5Hash(instr); Assert.AreEqual(expected, actual); }
public void validateComboBox1Test() { Library _libr = null; // TODO: Initialize to an appropriate value RegistrationControl target = new RegistrationControl(_libr); // TODO: Initialize to an appropriate value string country = string.Empty; // TODO: Initialize to an appropriate value bool expected = true; // TODO: Initialize to an appropriate value bool actual; actual = target.validateComboBox1(country); Assert.AreEqual(expected, actual); }
private void SetRegistrationState() { _currentState = States.Registration; _registrationControl = new RegistrationControl() { Location = new Point(10, 0) }; Controls.Add(_registrationControl); _prevState = States.Registration; }
public void checkCaptchaTest() { Library _libr = null; // TODO: Initialize to an appropriate value RegistrationControl target = new RegistrationControl(_libr); // TODO: Initialize to an appropriate value string _text = "TEST"; // TODO: Initialize to an appropriate value bool expected = true; // TODO: Initialize to an appropriate value bool actual; target.setText("TEST"); actual = target.checkCaptcha(_text); Assert.AreEqual(expected, actual); }
public void validateTextBox2Test() { Library _libr = null; // TODO: Initialize to an appropriate value RegistrationControl target = new RegistrationControl(_libr); // TODO: Initialize to an appropriate value string _password1 = "abc"; // TODO: Initialize to an appropriate value string _password2 = "abc"; // TODO: Initialize to an appropriate value bool expected = true; // TODO: Initialize to an appropriate value bool actual; actual = target.validateTextBox2(_password1, _password2); Assert.AreEqual(expected, actual); }
public void createPersonTest() { Library _libr = null; // TODO: Initialize to an appropriate value RegistrationControl target = new RegistrationControl(_libr); // TODO: Initialize to an appropriate value string p1 = string.Empty; // TODO: Initialize to an appropriate value string p2 = string.Empty; // TODO: Initialize to an appropriate value string p3 = string.Empty; // TODO: Initialize to an appropriate value string p4 = string.Empty; // TODO: Initialize to an appropriate value target.createPerson(p1, p2, p3, p4); Assert.AreNotEqual(target.getNewPerson(), null); }
public void createImageTest() { Library _libr = null; // TODO: Initialize to an appropriate value RegistrationControl target = new RegistrationControl(_libr); // TODO: Initialize to an appropriate value int Width = 10; // TODO: Initialize to an appropriate value int Height = 10; // TODO: Initialize to an appropriate value Bitmap expected = target.createImage(Width, Height);; // TODO: Initialize to an appropriate value Bitmap actual; actual = target.createImage(Width, Height); Assert.AreNotEqual(expected, actual); }
public void registerCompleteTest() { Library _libr = null; // TODO: Initialize to an appropriate value RegistrationControl target = new RegistrationControl(_libr); // TODO: Initialize to an appropriate value string p1 = "Acceptable"; // TODO: Initialize to an appropriate value string p2 = "Acceptable"; // TODO: Initialize to an appropriate value string p3 = "Acceptable"; // TODO: Initialize to an appropriate value string p4 = "Acceptable"; // TODO: Initialize to an appropriate value bool expected = true; // TODO: Initialize to an appropriate value bool actual; actual = target.registerComplete(p1, p2, p3, p4); Assert.AreEqual(expected, actual); }
private void RegistrationControl_OnRegistration(string login, string password) { int index = this.profiles.FindIndex(p => p.name == login); if (index == -1) { this.profiles.Add(new Profile { name = login, password = password, playLists = this.CreateStandartPlayList() }); this.EndAuth?.Invoke(this.profiles.Last()); ManagementSave.saveProfilesJSON(this.profiles); } else { RegistrationControl.showError("Данный пользователь уже существует"); } }