Example #1
0
 public RegistrationFeeModel()
 {
     Level              = new Level();
     Department         = new Department();
     RegistrationPeriod = new RegistrationPeriod();
     Programme          = new Programme();
 }
Example #2
0
        public async Task Register_Should_SaveRegistrationEntitySuccessfully_WhenRegistrationObjectIsSet()
        {
            string userId = "1";
            Level  level  = new Level()
            {
                Name = "Year 1"
            };
            Department department = new Department()
            {
                Name = "Business Administration"
            };
            Programme programme = new Programme()
            {
                Name = "Undergraduate Studies"
            };
            Semester semester = new Semester()
            {
                Name = "1st Semester",
            };
            Session session = new Session()
            {
                StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.AddMonths(4), CreatedBy = userId, CreatedOn = DateTime.UtcNow
            };

            RegistrationPeriod registrationPeriod = new RegistrationPeriod()
            {
                CreatedBy = "",
                StartDate = DateTime.UtcNow,
                EndDate   = DateTime.UtcNow.AddMonths(4),
                Semester  = semester,
                Session   = session,
                CreatedOn = DateTime.UtcNow,
            };

            RegistrationFee registrationFee = new RegistrationFee()
            {
                AccessCharge       = 5000,
                AmountPayable      = 120000,
                CanMakePartPayment = false,
                CreatedBy          = "1",
                CreatedOn          = DateTime.UtcNow,
                Department         = department,
                Level              = level,
                Programme          = programme,
                RegistrationPeriod = registrationPeriod,
            };

            Registration registration = new Registration()
            {
                StudentId          = userId,
                RegisteredOn       = DateTime.UtcNow,
                RegistrationFee    = registrationFee,
                RegistrationPeriod = registrationPeriod,
                Details            = new List <RegistrationDetail>()
                {
                    new RegistrationDetail()
                    {
                        AmountPaid = 120000, PaymentMethod = "paystack", PaymentStatus = 1, RegisteredOn = DateTime.UtcNow
                    }
                }
            };

            Registration newReg = await _registrationService.RegisterAsync(registration);

            Assert.NotNull(newReg);
            Assert.NotNull(newReg.Details);
            Assert.True(newReg.Details.Count > 0);
            Assert.True(newReg.Id > 0);
            Assert.Equal(registration.RegisteredOn, newReg.RegisteredOn);
        }