public void AddExistingUser() { Register reg = new Register(); reg.RemoveAll(); reg.Add("юзер", "123"); Assert.IsFalse(reg.Add("юзер", "")); }
public void RegisterAndCheckSomeUsers() { Register reg = new Register(); reg.RemoveAll(); Assert.IsTrue(reg.Add("юзер1", "123")); Assert.IsTrue(reg.Add("юзер2", "32")); Assert.IsTrue(reg.Contains("юзер1")); Assert.IsTrue(reg.Contains("юзер2")); Assert.IsTrue(reg.Check("юзер1", "123")); Assert.IsTrue(reg.Check("юзер2", "32")); }
private void btnAddOne_Click(object sender, EventArgs e) { if (cmbActive.Text == "Register" && mainRegister != null) { mainRegister.Add(); GlobalMethods.AddMessageToTextbox(mainRegister.GetLastMessage(), txtMessages); } else if (cmbActive.Text == "Diagnose" && mainDiagnose != null) { mainDiagnose.Add(); GlobalMethods.AddMessageToTextbox(mainDiagnose.GetLastMessage(), txtMessages); } }
private async void Register() { UserDialogs.Instance.ShowLoading("Registering Agent", MaskType.None); var model = new Agent { Username = Username, Password = Password, Email = Email, FirstName = FirstName, LastName = LastName, DateOfBirth = DateOfBirth, Gender = SGender }; var regService = new Register(); Response response = await regService.Add(model); if (!response.IsSuccessStatusCode) { await UserDialogs.Instance.AlertAsync("An error occured"); UserDialogs.Instance.HideLoading(); } else { await UserDialogs.Instance.AlertAsync("Agent registered successfully"); UserDialogs.Instance.HideLoading(); } }
static void Main(string[] args) { Register <IComparable> register = new Register <IComparable>(5); // Register the drop event listener. register.RaiseDropEventHandler += HandleDropEvent; // Loops forever and generates random values to add to the register. // The register does also work with other types implementing IComparable. for (int i = 0; i < 10; i++) { Random rnd = new Random(); register.Add(rnd.Next()); Console.WriteLine(register.ToString()); Console.WriteLine($"First element: {register.First()}"); Console.WriteLine($"Last element: {register.Last()}"); Console.WriteLine($"Count: {register.Count}"); Thread.Sleep(300); } register.Clear(); Console.WriteLine(register.ToString()); Console.ReadKey(); /*register.Add(1); * register.Add(1.2); * register.Add(2.5f); * register.Add(long.Parse("12")); * register.Add("hallo");*/ }
/// <summary> /// 增加 命令回调属性 /// </summary> /// <param name="element"></param> private void AddCallbackAttributes(XElement element) { if (_command is AbstractCommand cmd) { cmd.WriteXml(element); cmd.ControlId = ControlId.Value; Register?.Add(ControlId, _command); } }
public void RemoveAll() { Register reg = new Register(); reg.Add("юзер", "213"); reg.RemoveAll(); Assert.IsFalse(reg.Contains("юзер")); Assert.IsFalse(reg.Check("юзер", "213")); }
private void AddToRegister(int index, int value) { while (Register.Count - 1 < index) { Register.Add(0); } Register[index] = value; }
public void Add(TValue value, TKey key, TOptKey optKey) { Add(value, key); if (optKey != default) { optionalRegister.Add(value, optKey); } }
public void CheckWithBadPassword() { Register reg = new Register(); reg.RemoveAll(); reg.Add("юзер", "213"); Assert.IsTrue(reg.Contains("юзер")); Assert.IsFalse(reg.Check("юзер", "пароль")); }
public IActionResult Kayit(UserResponse userResponse) { if (ModelState.IsValid) { Register.Add(userResponse); return(View("Tebrikler", userResponse)); } return(View()); }
public static void Add <T>(IMyEntity entity, T item) { if (Globals.WorldClosed || entity.Closed) { return; } Register <T> .Add(entity.EntityId, item); entity.OnClose += OnClose <T>; }
public void Load_Success() { Register reg = new Register(); reg.RemoveAll(); reg.Add("юзер", "суперюзер"); reg.Save(); reg = new Register(); Assert.IsFalse(reg.Check("юзер", "суперюзер")); Assert.IsTrue(reg.Load()); Assert.IsTrue(reg.Check("юзер", "суперюзер")); }
public Check NewCheck() { Check check = new Check() { CheckNumber = Register.Any() ? Register.Max(c => c.CheckNumber) + 1 : 101, Date = DateTime.Now.AddDays(rng.Next(-60, 60)), Amount = (rng.NextDouble() * 300) - rng.NextDouble() * 150, Cleared = (rng.Next(2) % 2 == 0), Payee = payees[rng.Next(payees.Length - 1)], }; Register.Add(check); return(check); }
void Detect() { bool AllRight = true; List <MyDetectedEntityInfo> Detected; foreach (IMySensorBlock rad in Radars) { if (rad != null) { Detected = new List <MyDetectedEntityInfo>(); rad.DetectedEntities(Detected); foreach (MyDetectedEntityInfo entity in Detected) { if (Register.Add(entity)) { SendCoords(entity.Position, entity.Velocity, entity.EntityId.ToString()); } } } else { AllRight = false; } } if (Turret_Controller != null && AEGIS) { string output = ""; List <Entry> targets = Register.GetRefList(); foreach (Entry entry in targets) { output += RelationToLetter(entry.Relation) + entry.Id + ";" + entry.Stringify() + "\n"; } if (targets.Count > 0) { Me.CustomData = output; Turret_Controller.TryRun("reg"); } } if (!AllRight) { GetRadars(); } }
//Populate the script lists here. Follow the example on how to add to a list #region Populate Lists /// <summary> /// Use this method to populate the lists. They are already set to be selected from the /// CycleScripts method and no other work is required. /// </summary> public override void PopulateLists() { BrowserState.Clear(); Locale.Clear(); Purchase.Clear(); Register.Clear(); SingleSignOn.Clear(); SingleSignOnLocale.Clear(); base.PopulateLists(); //SignIn.Add(new Connect_SignIn(base.baseURL, base.webdriver, base.verificationErrors)); BrowserState.Add(new BrowserStateTest(base.baseURL, base.webdriver, base.verificationErrors)); Locale.Add(new LocaleTest(base.baseURL, base.webdriver, base.verificationErrors)); Purchase.Add(new PurchaseTest(base.baseURL, base.webdriver, base.verificationErrors)); Register.Add(new RegisterUserTest(base.baseURL, base.webdriver, base.verificationErrors)); SingleSignOnLocale.Add(new SingleSignOnLocaleTest(base.baseURL, base.webdriver, base.verificationErrors)); SingleSignOn.Add(new SingleSignOnTest(base.baseURL, base.webdriver, base.verificationErrors)); }
void ScheduleLaunch(int key, int TTL = 0) { LauncherSegment launcher; if (launchers.TryGetValue(key, out launcher)) { if (launcher.busy) { Error("Error: One or more launchers was already on the Register."); return; } launcher.busy = true; Register.Add(new Job(JobType.ACCELERATE, TTL, key)); Register.Add(new Job(JobType.LOAD, TTL + 24, key)); } else { Log("Error: A launcher with a code '" + key + "' does not exist."); } }
private static void AddRegister(object newViewModel, string regionName, FrameworkElement control) { if (newViewModel == null) { return; } if (!Register.TryGetValue(newViewModel, out var regionControlDictionary)) { Log.Debug($"Creating region register for {newViewModel.GetType().FullName}"); regionControlDictionary = new Dictionary <string, FrameworkElement>(); Register.Add(newViewModel, regionControlDictionary); } if (regionName != null) { Log.Debug($"Registering control [{control.GetType().FullName}] as region [{regionName}] for viewmodel {newViewModel.GetType().FullName}"); control.Unloaded += ControlOnUnloaded; regionControlDictionary.Add(regionName, control); } }
public int ProcessInstructionResult(List <string> instructionParts) { if (!Register.ContainsKey(instructionParts[0])) { Register.Add(instructionParts[0], 0); } if (!Register.ContainsKey(instructionParts[4])) { Register.Add(instructionParts[4], 0); } if (Compare(instructionParts[5], Register[instructionParts[4]], int.Parse(instructionParts[6]))) { var variable = Register[instructionParts[0]]; Register[instructionParts[0]] = instructionParts[1] == "inc" ? variable + int.Parse(instructionParts[2]) : variable - int.Parse(instructionParts[2]); } HigherValueDuringProcess = HigherValueDuringProcess < Register[instructionParts[0]] ? Register[instructionParts[0]] : HigherValueDuringProcess; return(Register[instructionParts[0]]); }
private void btn_register_Click(object sender, EventArgs e) { if (txt_location.Text == "") { MessageBox.Show("Please Select the Location of the Library", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txt_ProgID.Text == "") { MessageBox.Show("Please Enter the ProgID of the Library", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Register register = new Register(); register.Add(cbx_type.Text, cbx_language.Text, txt_location.Text, txt_ProgID.Text); MessageBox.Show(txt_ProgID.Text + " Registered!", "NOTICE", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void Accept(Service service) { _register.Add(service); _keys.Add(service.Name); }
public void Main(string argument, UpdateType updateSource) { if ((updateSource & (UpdateType.Update1 | UpdateType.Update10 | UpdateType.Update100)) > 0) { if (MAINTEANCE_NUM++ >= MAINTEANCE_FREQUENCY) { MAINTEANCE_NUM = 0; CheckAvailability(); } if (!lastColor.Equals(COLOR_BLACK)) { SetNextColor(); } Output(GenerateStatus()); Job current = Register.Tick(); if (current != null) { DoTheJob(current); } if (Register.GetSize() <= 0) { DoTheJob(new Job(JobType.CLOSE_DOOR)); } } else if ((updateSource & UpdateType.IGC) > 0) { } else { if (argument.Length > 0) { string[] args = argument.ToLower().Split(' '); switch (args[0]) { case "open": Register.Add(new Job(JobType.OPEN_DOOR)); break; case "close": Register.Add(new Job(JobType.CLOSE_DOOR)); break; case "load": if (args.Length > 1) { int lnchNo; if (int.TryParse(args[1], out lnchNo) && launchers.ContainsKey(lnchNo)) { Register.Add(new Job(JobType.LOAD, 1, lnchNo)); } } break; case "mid": if (args.Length > 1) { int lnchNo; if (int.TryParse(args[1], out lnchNo) && launchers.ContainsKey(lnchNo)) { Register.Add(new Job(JobType.MIDSTATE, 1, lnchNo)); } } break; case "fire": if (args.Length > 1) { int lnchNo; if (int.TryParse(args[1], out lnchNo)) { PrepareLaunch(lnchNo); } } else { PrepareSalvo(); } break; case "accel": if (args.Length > 1) { int lnchNo; if (int.TryParse(args[1], out lnchNo) && launchers.ContainsKey(lnchNo)) { Register.Add(new Job(JobType.ACCELERATE, 1, lnchNo)); } } break; } } } }
static void Main(string[] args) { Register register = new Register(new List <Student>(), new List <Employee>(), new List <Course>()); // Add student register.Add("Hans"); register.Add("Haaaaans"); List <Student> studentsList = register.GetStudents(); for (int i = 0; i < studentsList.Count; i++) { Console.WriteLine("ID: " + studentsList[i].id + " - Name: " + studentsList[i].name); } Console.ReadKey(); // Edit Student Console.WriteLine("Enter ID of student you want to change"); var id = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the new name of the student"); var newName = Console.ReadLine(); register.Edit(id, newName); Console.WriteLine(); for (int i = 0; i < studentsList.Count; i++) { Console.WriteLine("ID: " + studentsList[i].id + " - Name: " + studentsList[i].name); } Console.ReadKey(); // Add employee (name, is Teacher?, salary, was paid, courses register.Add("Teacher1", true, 20000, false); register.Add("Teacher2", true, 25000, false); List <Employee> employeeList = register.GetEmployees(); for (int i = 0; i < employeeList.Count; i++) { Console.WriteLine("ID: " + employeeList[i].id + " - Name: " + employeeList[i].name + " " + employeeList[i].salary); } Console.ReadKey(); // Edit employee Console.WriteLine("Enter ID of employee you want to change"); id = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the new name of the employee"); newName = Console.ReadLine(); Console.WriteLine("Enter the new salary"); var salary = int.Parse(Console.ReadLine()); register.Edit(id, newName, true, salary, true); Console.WriteLine(); for (int i = 0; i < employeeList.Count; i++) { Console.WriteLine("ID: " + employeeList[i].id + " - Name: " + employeeList[i].name + " " + employeeList[i].salary); } Console.ReadKey(); // Add course/class register.Add("Math", 0, null); register.Add("English", 0, null); register.Add("English adv", 0, null); List <Course> coursesList = register.GetCourses(); Console.WriteLine(); for (int i = 0; i < coursesList.Count; i++) { Console.WriteLine("ID: " + coursesList[i].id + " - Name: " + coursesList[i].courseName); } // Edit course/class Console.WriteLine("Enter ID of course you want to change"); id = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the new name of the course"); newName = Console.ReadLine(); Console.WriteLine("Enter the new student count"); var studentCount = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the name of the teacher"); var newTeacher = Console.ReadLine(); register.Edit(id, newName, studentCount, newTeacher); Console.WriteLine(); for (int i = 0; i < coursesList.Count; i++) { Console.WriteLine("ID: " + coursesList[i].id + " - Name: " + coursesList[i].courseName); } // Remove course/class based on ID Console.WriteLine("Enter ID of class to be removed"); var removeCourseInput = Console.ReadLine(); register.Remove(coursesList[int.Parse(removeCourseInput)]); for (int i = 0; i < coursesList.Count; i++) { Console.WriteLine("ID: " + coursesList[i].id + " - Name: " + coursesList[i].courseName); } }
void PrepareGPSStrike(double X, double Y, double Z, string code = GPSSTRIKE_CODE) { Register.Add(code, new Entry(X, Y, Z)); PrepareForLaunch(code); }