Exemple #1
0
        public async Task GetTranscriptImportedBySchoolIdAsync_should_return_expected_value()
        {
            // Arrange:
            var studentNumber = "AP-API-IT";
            var studentName   = "IntegrationTests, ApplicationPlanner.API";
            var dob           = "2000/01/01";
            var dobParts      = dob.Split('/');
            var expectedValue = new TranscriptImportedViewModel
            {
                Id                = integrationTestPortfolioId,
                UserAccountId     = 293945,
                AvatarFileName    = null,
                SchoolCountryType = CC.Common.Enum.CountryType.US,
                StudentName       = studentName,
                DateOfBirth       = new DateTime(int.Parse(dobParts[0]), int.Parse(dobParts[1]), int.Parse(dobParts[2])),
                GradeId           = 11,
                GradeKey          = "GRADE_11",
                StudentId         = studentNumber,
                TranscriptId      = 1000000, // We know in Xello TranscriptId starts at 1000000
                ImportedDate      = DateTime.UtcNow
            };
            // Reset
            await _sql.ExecuteAsync("DELETE FROM ApplicationPlanner.Transcript WHERE PortfolioId = @portfolioId", new { portfolioId = integrationTestPortfolioId });

            await _sql.ExecuteAsync("DELETE FROM ApplicationPlanner.TranscriptLog WHERE StudentNumber = @studentNumber", new { studentNumber });

            // Import a transcript and automatch it to the integration test student
            await _qaRepository.ImportTranscriptAsync(integrationTestPortfolioId, integrationTestSchoolId, studentNumber, studentName, dob, "*****@*****.**");

            // Act:
            var result = (await _transcriptRepository.GetTranscriptImportedBySchoolIdAsync(integrationTestSchoolId)).ToList();

            // Assert:
            Assert.IsTrue(result.IsNotNullOrEmpty());
            Assert.IsTrue(result.Count == 1);
            Assert.AreEqual(expectedValue.Id, result[0].Id);
            Assert.AreEqual(expectedValue.UserAccountId, result[0].UserAccountId);
            Assert.AreEqual(expectedValue.AvatarFileName, result[0].AvatarFileName);
            Assert.AreEqual(expectedValue.SchoolCountryType, result[0].SchoolCountryType);
            Assert.AreEqual(expectedValue.StudentName, result[0].StudentName);
            Assert.AreEqual(expectedValue.DateOfBirth, result[0].DateOfBirth);
            Assert.AreEqual(expectedValue.GradeId, result[0].GradeId);
            Assert.AreEqual(expectedValue.GradeKey, result[0].GradeKey);
            Assert.AreEqual(expectedValue.StudentId, result[0].StudentId);
            Assert.IsTrue(result[0].TranscriptId >= expectedValue.TranscriptId); // the id for the new transcript should be >= than the min allowed
            Assert.IsTrue(result[0].ImportedDate != null);
        }