public async void GetClass_ReturnsClass() { // Arrange var toGet = new Class() { ID = "1", color = "green", icon = "important", name = "iet", userID = "0" }; // Act var result = await controller.GetClass("1"); // Assert result.Value.Should().BeEquivalentTo(toGet); }
public void GetClass_Test() { var Respond = _classController.GetClass(2); var Result = Respond as OkObjectResult; Assert.AreEqual(200, Result.StatusCode); }
private void OnChangeGrade(object sender, EventArgs e) { BackgroundWorker worker = new BackgroundWorker(); List <Class> classes = new List <Class>(); bool success; listClass.Enabled = cbbGrade.Enabled = false; if (cbbGrade.SelectedIndex == 3) { worker.DoWork += (s, ev) => { success = classController.GetAllClass(classes); }; } else { string grade = cbbGrade.Text; worker.DoWork += (s, ev) => { if (!string.IsNullOrEmpty(grade)) { classes = classController.GetClass(grade); } }; } worker.RunWorkerCompleted += (s, ev) => { if (cbbClass.Visible) { if (cbbGrade.Text == "Tất cả") { return; } cbbClass.Items.Clear(); foreach (Class _class in classes) { cbbClass.Items.Add(_class.ID); } cbbClass.Enabled = true; } else { listClass.Controls.Clear(); foreach (Class _class in classes) { listClass.Controls.Add(CreateCheckBox(_class.ID + " - Sỉ số: " + _class.StudentNum.ToString())); } listClass.Enabled = true; LoadChart(btnOK, EventArgs.Empty); } cbbGrade.Enabled = true; }; worker.RunWorkerAsync(); }
private void OnChangeGrade(object sender, EventArgs e) { BackgroundWorker worker = new BackgroundWorker(); List <Class> classes = new List <Class>(); bool success; cbbGrade.Enabled = cbbClass.Enabled = false; if (cbbGrade.SelectedIndex == 3) { worker.DoWork += (s, ev) => { success = classController.GetAllClass(classes); }; } else { string grade = cbbGrade.Text; worker.DoWork += (s, ev) => { if (!string.IsNullOrEmpty(grade)) { classes = classController.GetClass(grade); } }; } worker.RunWorkerCompleted += (s, ev) => { cbbClass.Items.Clear(); foreach (Class _class in classes) { cbbClass.Items.Add(_class.ID); if (_class.ID == classID) { cbbClass.SelectedIndex = cbbClass.Items.Count - 1; } } if (teacherType != Teacher.TeacherType.FormerTeacher) { cbbClass.Enabled = cbbGrade.Enabled = true; if (cbbClass.Items.Count > 0) { cbbClass.SelectedIndex = 0; cbbClass.Invalidate(); } } else { } }; worker.RunWorkerAsync(); }
// Start is called before the first frame update void Start() { bool newPlayer = true; //this will be changed. Later. if (newPlayer) { CurrentStats = new Stats(); ClassController classController = new ClassController(); CurrentClass = classController.GetClass(ChosenClass); CurrentStats.UpdateStatsByClass(CurrentClass); CurrentEquipment = new EquipmentController(); } //Load stuff and add it to the exisiting player? }
private void StudentScore_Load(object sender, EventArgs e) { STUDENT student = new STUDENT(); StudentController studentController = new StudentController(); ClassController classController = new ClassController(); YearController yearController = new YearController(); SemesterController semesterController = new SemesterController(); ConductController conductController = new ConductController(); student = studentController.getStudent(_username); txtMSHS.Text = student.MSHOCSINH; txtBirthday.Text = student.BIRTHDAY.ToString(); txtName.Text = student.NAME; cmbYear.ValueMember = "SCHOOLYEARID"; cmbYear.DisplayMember = "NAME"; cmbYear.DataSource = yearController.GetListYear(student.MSHOCSINH); cmbSemester.ValueMember = "SEMESTERID"; cmbSemester.DisplayMember = "NAME"; cmbSemester.DataSource = semesterController.GetAll(); txtClass.Text = classController.GetClass(cmbYear.SelectedValue.ToString(), student.MSHOCSINH); if (CaculateScores() != -1) { txtAverageScore.Text = CaculateScores().ToString(); } if (CaculateScores() < (decimal)3.5) { txtType.Text = "kém"; } else if (CaculateScores() < (decimal)5) { txtType.Text = "yếu"; } else if (CaculateScores() < (decimal)6.5) { txtType.Text = "TB"; } else if (CaculateScores() < (decimal)8) { txtType.Text = "Khá"; } else { txtType.Text = "Giỏi"; } txtConduct.Text = conductController.GetConducName(txtMSHS.Text, (decimal)cmbSemester.SelectedValue, cmbYear.SelectedValue.ToString()); }
public void GetStudentInfo(Student s) { int sId = s.sId; int secId = s.secId; int cId = s.cId; textBoxName.Text = s.name; textBoxClass.Text = ClassController.GetClass(cId).clas.ToString(); textBoxSection.Text = SectionController.GetSection(secId).secName.ToString(); textBoxFathersName.Text = s.fatherName; textBoxMothersName.Text = s.motherName; textBoxRoll.Text = s.roll; textBoxDateOfBirth.Text = s.dateOfBirth.ToString(); textBoxDateOfAdmission.Text = s.dateOfAdmission.ToString(); textBoxContact.Text = s.contact; richTextBoxAddress.Text = s.address; textBoxGender.Text = s.gender; textBoxRoll.Text = s.roll; }
private void cbbKhoi_SelectedIndexChanged(object sender, EventArgs e) { string KhoiSelected = null; KhoiSelected = cbbKhoi.Text; if (KhoiSelected == null) { return; } cbbClass.Items.Clear(); List <Class> LopThuocKhoi = classController.GetClass(KhoiSelected); foreach (var i in LopThuocKhoi) { cbbClass.Items.Add(i.ID); } return; }