public void Deduct() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); student.RaiseCourse(); FillAllMarks(ref student, 4); Assert.AreNotEqual(student.course, 0); for (int i = 0; i < UniversityStudent.N_OF_SUBJECTS; i++) { Assert.AreNotEqual(student.GetMark(i), 0); } student.Deduct(); Assert.AreEqual(student.course, 0); for (int i = 0; i < UniversityStudent.N_OF_SUBJECTS; i++) { Assert.AreEqual(student.GetMark(i), 0); } }
private void FillAllMarksDifferent(ref UniversityStudent _student) { for (int i = 0; i < UniversityStudent.N_OF_SUBJECTS; i++) { _student.SetMark(i, i % 6); } }
private void CheckAllMarksDifferentWritten(ref UniversityStudent _student) { for (int i = 0; i < UniversityStudent.N_OF_SUBJECTS; i++) { Assert.AreEqual(_student.GetMark(i), i % 6); } }
private void FillAllMarks(ref UniversityStudent _student, int _value) { for (int i = 0; i < UniversityStudent.N_OF_SUBJECTS; i++) { _student.SetMark(i, _value); } }
public void InitNormal() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); }
public void InitNegativeScholarship() { UniversityStudent student; Assert.That(() => { student = new UniversityStudent( name, surname, patronymic, course, birthday, -100, balance ); }, Throws.TypeOf <ArgumentOutOfRangeException>()); }
public void RaiseCourse() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); student.RaiseCourse(); Assert.AreEqual(student.course, course + 1); }
public void SetAllValidMarks() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); FillAllMarksDifferent(ref student); CheckAllMarksDifferentWritten(ref student); }
public void GetBigMarkIndex() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); Assert.That(() => { student.GetMark(UniversityStudent.N_OF_SUBJECTS); }, Throws.TypeOf <ArgumentOutOfRangeException>()); }
public void SetNegativeMarkIndex() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); Assert.That(() => { student.SetMark(-1, 5); }, Throws.TypeOf <ArgumentOutOfRangeException>()); }
public void SetValidMark() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); const int pos = 0, value = 5; student.SetMark(pos, value); Assert.AreEqual(student.GetMark(pos), value); }
public void AddScholarship() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); FillAllMarks(ref student, 4); student.AddScholarship(); Assert.AreEqual(balance + scholarship, student.scholarship); }
public void AddScholarshipWithBadMarks() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); FillAllMarks(ref student, 3); Assert.That(() => { student.AddScholarship(); }, Throws.TypeOf <ArgumentException>()); }
public void WithdrawTooMuchMoney() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); FillAllMarks(ref student, 4); student.AddScholarship(); Assert.That( () => { student.Withdraw(scholarship + 1); }, Throws.TypeOf <ArgumentOutOfRangeException>()); }
public void Equality() { UniversityStudent student1; student1 = new UniversityStudent( name, surname, patronymic, course, birthday, 0, 0 ); FillAllMarks(ref student1, 4); UniversityStudent student2; student2 = new UniversityStudent( name, surname, patronymic, course, new DateTime(10, 10, 10), 10.0, 10.0 ); FillAllMarks(ref student2, 4); Assert.IsTrue(student1 == student2); }
public void WithdrawAllMoney() { UniversityStudent student; student = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); FillAllMarks(ref student, 4); student.AddScholarship(); double prev_balance = student.balance; double got = student.Withdraw(scholarship); Assert.AreEqual(got, scholarship); Assert.AreEqual(student.balance, prev_balance - scholarship); }
public void EqualityNotEqualMarks() { UniversityStudent student1; student1 = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); FillAllMarks(ref student1, 4); UniversityStudent student2; student2 = new UniversityStudent( name, surname, patronymic, course, birthday, scholarship, balance ); FillAllMarks(ref student2, 4); student2.SetMark(0, 5); Assert.IsFalse(student1 == student2); Assert.IsTrue(student1 != student2); }