Beispiel #1
0
        public async Task GetTranscriptUnmatchedBySchoolIdAsync_should_return_expected_value()
        {
            // Arrange:
            var receivedDateUtc = DateTime.UtcNow;
            var studentNumber   = "AP-API-IT-2";
            var studentName     = "IntegrationTests-2, ApplicationPlanner.API";
            var dob             = "2000/01/01";
            var expectedValue   = new TranscriptBaseModel
            {
                TranscriptId    = 1000000,
                StudentName     = studentName,
                StudentNumber   = studentNumber,
                DateOfBirth     = dob,
                ReceivedDateUtc = receivedDateUtc
            };
            // Reset
            await _sql.ExecuteAsync("DELETE FROM ApplicationPlanner.Transcript WHERE StudentNumber = @studentNumber", new { studentNumber });

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

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

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

            // Assert:
            Assert.IsTrue(result.IsNotNullOrEmpty());
            Assert.IsTrue(result.Count >= 1);
            var justAddedTranscript = result.SingleOrDefault(t => t.StudentNumber == studentNumber);

            Assert.IsTrue(justAddedTranscript.TranscriptId >= expectedValue.TranscriptId); // the id for the new transcript should be >= than the min allowed
            Assert.AreEqual(justAddedTranscript.StudentName, result[0].StudentName);
            Assert.AreEqual(justAddedTranscript.StudentNumber, result[0].StudentNumber);
            Assert.AreEqual(justAddedTranscript.DateOfBirth, result[0].DateOfBirth);
            Assert.IsTrue(justAddedTranscript.ReceivedDateUtc != null);
        }