コード例 #1
0
        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);
        }
コード例 #2
0
        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>());
        }
コード例 #3
0
        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>());
        }
コード例 #4
0
        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);
        }