示例#1
0
        public void UpdateCaseReport_EmptyFullName_InvalidDataException()
        {
            // Arrange
            var(unitOfWork, caseReportRepo, dbCollectionCaseReport) = GetMocks();
            var service    = new CaseReportService(unitOfWork.Object);
            var caseReport = new CaseReport()
            {
                Diagnosis = ""
            };

            // Act + Assert
            Assert.ThrowsAsync <InvalidDataException>(async() => await service.UpdateCaseReport(27, caseReport));
        }
示例#2
0
        public void UpdateCaseReport_NoItemForUpdate_NullReferenceException()
        {
            // Arrange
            var(unitOfWork, caseReportRepo, dbCollectionCaseReport) = GetMocks();
            var service    = new CaseReportService(unitOfWork.Object);
            var caseReport = new CaseReport()
            {
                Diagnosis = "Update Track"
            };

            // Act + Assert
            Assert.ThrowsAsync <NullReferenceException>(async() => await service.UpdateCaseReport(0, caseReport));
        }
示例#3
0
        public async Task UpdateCaseReport_FullInfo_Success()
        {
            // Arrange
            var(unitOfWork, caseReportRepo, dbCollectionCaseReport) = GetMocks();
            var service    = new CaseReportService(unitOfWork.Object);
            var caseReport = new CaseReport
            {
                PatientId = 27,
                Diagnosis = "New Diagnosis"
            };

            // Act
            await service.UpdateCaseReport(27, caseReport);

            // Assert
            Assert.AreEqual((await unitOfWork.Object.CaseReports.GetWithPatientByIdAsync(27)).Diagnosis, caseReport.Diagnosis);
        }