コード例 #1
0
 private void InsertBtn_Click(object sender, EventArgs e)
 {
     if (NameTb.Text != "" || PhoneTb.Text != "" || AddressTb.Text != "" || FatherNameTb.Text != "" || PhoneTb.Text != "" || SessionTb.Text != "")
     {
         _student.Name       = NameTb.Text;
         _student.FatherName = FatherNameTb.Text;
         _student.Phone      = PhoneTb.Text;
         _student.Address    = AddressTb.Text;
         _student.Session    = SessionTb.Text;
         _student.Class      = ClassTb.Text;
         _student.Email      = EmailTb.Text;
         _student.Dob        = DOBvalue.Value;
         _student.AdminDate  = AdminDateValue.Value;
         _student.Gender     = GenderTb.Text;
         _studentService.InsertStudent(_student);
         MessageBox.Show("Record Added Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
         RollNoTb.ResetText();
         NameTb.ResetText();
         FatherNameTb.ResetText();
         GenderTb.Text = "Select One";
         PhoneTb.ResetText();
         AddressTb.ResetText();
         SessionTb.ResetText();
         AdminDateValue.ResetText();
         ClassTb.Text = "Select One";
         EmailTb.ResetText();
         DOBvalue.ResetText();
     }
     else
     {
         MessageBox.Show("Please Fill all fields!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
コード例 #2
0
        public void InsertStudentTest()
        {
            // Arrange


            // Act
            _studentsService.InsertStudent(_studentBL);


            // Assert
            _mockIStudentRepository.Verify(rs => rs.InsertStudent(It.Is <Student>(st => st.EMail == "[email protected]" && st.FullName == "Ivan" && st.Phone == "12345678")));
        }