Esempio n. 1
0
 public TranscriptsController(IInstitutionRepository institutionRepository, ITranscriptProviderService transcriptProviderService, ITranscriptRepository transcriptRepository, ITranscriptService transcriptService, ILinqWrapperService linqWrapperService)
 {
     _institutionRepository     = institutionRepository;
     _transcriptProviderService = transcriptProviderService;
     _transcriptRepository      = transcriptRepository;
     _transcriptService         = transcriptService;
     _linqWrapperService        = linqWrapperService;
 }
Esempio n. 2
0
        public async Task TranscriptRequest_SendForInactiveSchool_ShouldThrowUnlicensedSchoolException()
        {
            // Arrange
            SchoolSettingModel schoolSettings = new SchoolSettingModel();

            schoolSettings.SchoolSettingId     = 1;
            schoolSettings.SchoolId            = 12345;
            schoolSettings.IsTranscriptEnabled = false;

            _mockSchoolSettingRepository.Setup(x => x.GetBySchoolIdAsync(It.IsAny <int>())).Returns(Task.FromResult <SchoolSettingModel>(schoolSettings));
            ITranscriptProviderService tps = CreateService();

            // Act
            await tps.SendTranscriptRequestAsync(55, "12345", 1, 12345, "45784", "NCAA", 1, "");

            // Assert (ExpectedException) -> See the applied ExpectedException attribute to the test's method
        }
Esempio n. 3
0
        public async Task TranscriptRequest_DeleteForInactiveSchool_ShouldThrowUnlicensedSchoolException()
        {
            // Arrange
            SchoolSettingModel schoolSettings = new SchoolSettingModel();

            schoolSettings.SchoolSettingId     = 1;
            schoolSettings.SchoolId            = xello_test_account_school_id;
            schoolSettings.IsTranscriptEnabled = false;

            _mockSchoolSettingRepository.Setup(x => x.GetBySchoolIdAsync(It.IsAny <int>())).Returns(Task.FromResult <SchoolSettingModel>(schoolSettings));

            ITranscriptProviderService tps = CreateService();

            // Act
            await tps.DeleteTranscriptAsync(xello_test_account_school_id, "Student1234", 55);

            // Assert (ExpectedException)  -> See the applied ExpectedException attribute to the test's method
        }
Esempio n. 4
0
        public async Task Transcript_ImportForUnlicensedSchool_ShouldThrowUnlicensedSchoolException()
        {
            // Arrange
            SchoolSettingModel schoolSettings = new SchoolSettingModel
            {
                SchoolSettingId     = 1,
                SchoolId            = xello_test_account_school_id,
                IsTranscriptEnabled = false
            };

            _mockSchoolSettingRepository.Setup(x => x.GetBySchoolIdAsync(It.IsAny <int>())).Returns(Task.FromResult <SchoolSettingModel>(schoolSettings));

            ITranscriptProviderService tps = CreateService();
            MemoryStream fileStream        = new MemoryStream();

            // Act
            await tps.ImportTranscriptAsync(xello_test_account_school_id, 12, "pdf", fileStream);

            // Assert (ExpectedException)  -> See the applied ExpectedException attribute to the test's method
        }
Esempio n. 5
0
        public async Task Transcript_Delete_Success()
        {
            // Arrange
            SchoolSettingModel schoolSettings = new SchoolSettingModel
            {
                SchoolSettingId     = 1,
                SchoolId            = xello_test_account_school_id,
                IsTranscriptEnabled = true
            };

            _mockSchoolSettingRepository.Setup(x => x.GetBySchoolIdAsync(It.IsAny <int>())).Returns(Task.FromResult <SchoolSettingModel>(schoolSettings));

            ITranscriptProviderService tps = CreateService();

            // Act
            await tps.DeleteTranscriptAsync(xello_test_account_school_id, "Student1234", 55);

            // Assert (ran the underlying API call)
            _mockTranscriptProviderAPIService.Verify(m => m.DeleteTranscriptAsync(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <int>()), Times.Once());
        }
Esempio n. 6
0
        public async Task TranscriptRequest_Send_Success()
        {
            // Arrange
            SchoolSettingModel schoolSettings = new SchoolSettingModel();

            schoolSettings.SchoolSettingId     = 1;
            schoolSettings.SchoolId            = xello_test_account_school_id;
            schoolSettings.IsTranscriptEnabled = true;

            _mockSchoolSettingRepository.Setup(x => x.GetBySchoolIdAsync(It.IsAny <int>())).Returns(Task.FromResult <SchoolSettingModel>(schoolSettings));
            ITranscriptProviderService tps = CreateService();

            // Act
            await tps.SendTranscriptRequestAsync(55, "12345", 1, xello_test_account_school_id, "45784", "NCAA", 1);

            // Assert (ran the underlying API call)
            _mockTranscriptProviderAPIService.Verify(m => m.SendTranscriptRequestAsync(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), ""), Times.Once());

            // Assert (appended to transcript request history)
            _mockTranscriptRequestRepository.Verify(m => m.AppendHistoryAsync(It.IsAny <int>(), TranscriptRequestStatus.Submitted, It.IsAny <int>()));
        }
Esempio n. 7
0
        public async Task Transcript_Import_Success()
        {
            // Arrange
            SchoolSettingModel schoolSettings = new SchoolSettingModel
            {
                SchoolSettingId     = 1,
                SchoolId            = xello_test_account_school_id,
                IsTranscriptEnabled = true
            };

            _mockSchoolSettingRepository.Setup(x => x.GetBySchoolIdAsync(It.IsAny <int>())).Returns(Task.FromResult <SchoolSettingModel>(schoolSettings));

            ITranscriptProviderService tps = CreateService();
            MemoryStream fileStream        = new MemoryStream();

            // Act
            await tps.ImportTranscriptAsync(xello_test_account_school_id, 12, "pdf", fileStream);

            // Assert (ran the underlying API call)
            _mockTranscriptProviderAPIService.Verify(m => m.ImportTranscriptAsync(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <MemoryStream>()), Times.Once());
        }
 public InstitutionsController(IInstitutionRepository institutionsRepository, ITranscriptProviderService transcriptProviderService)
 {
     _institutionsRepository    = institutionsRepository;
     _transcriptProviderService = transcriptProviderService;
 }