Esempio n. 1
0
        public async Task TestExistsIdOutOfRange(int testId)
        {
            // Arrange
            var service = new PatientService(null, null);

            // Act
            async Task <bool> TestAction() => await service.Exists(testId);

            // Assert
            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(TestAction);
        }
Esempio n. 2
0
        public async Task TestExistsIdValid()
        {
            // Arrange
            var mockUnitOfWork = new Mock <IUnitOfWork>();

            mockUnitOfWork
            .Setup(x => x.PatientRepository.GetById(1))
            .ReturnsAsync(new Patient {
                Id = 1
            });

            var service = new PatientService(mockUnitOfWork.Object, null);

            // Act
            var result = await service.Exists(1);

            // Assert
            Assert.True(result);
        }