public EndCarePackageReclaimUseCaseTests()
        {
            _carePackageReclaimGatewayMock = new Mock <ICarePackageReclaimGateway>();
            _carePackageHistoryGatewayMock = new Mock <ICarePackageHistoryGateway>();
            _carePackageGatewayMock        = new Mock <ICarePackageGateway>();
            _dbManagerMock = new Mock <IDatabaseManager>();

            var ensureSingleActivePackageTypePerUserUseCase = new EnsureSingleActivePackageTypePerUserUseCase(_carePackageGatewayMock.Object);

            _useCase = new EndCareChargeUseCase(_carePackageReclaimGatewayMock.Object,
                                                _dbManagerMock.Object,
                                                _carePackageHistoryGatewayMock.Object,
                                                _carePackageGatewayMock.Object);
        }
Beispiel #2
0
        public void ShouldNotFailWhenUserDoesNotHaveActivePackage()
        {
            var packageId     = Guid.NewGuid();
            var serviceUserId = Guid.NewGuid();
            var packageType   = PackageType.NursingCare;

            _carePackageGateway
            .Setup(g => g.GetServiceUserActivePackagesCount(serviceUserId, packageType, packageId))
            .ReturnsAsync(0);

            var useCase = new EnsureSingleActivePackageTypePerUserUseCase(_carePackageGateway.Object);

            useCase
            .Invoking(uc => uc.ExecuteAsync(serviceUserId, packageType, packageId))
            .Should().NotThrow();
        }
Beispiel #3
0
        public UpdateCarePackageUseCaseTests()
        {
            _dbManager                    = new Mock <IDatabaseManager>();
            _carePackageGateway           = new Mock <ICarePackageGateway>();
            _carePackageSettingsGateway   = new Mock <ICarePackageSettingsGateway>();
            _createPackageResourceUseCase = new Mock <ICreatePackageResourceUseCase>();

            _carePackageGateway.Setup(cp => cp.GetPackagePlainAsync(It.IsAny <Guid>(), It.IsAny <bool>())).ReturnsAsync(() => null);
            _carePackageSettingsGateway.Setup(cps => cps.GetPackageSettingsPlainAsync(It.IsAny <Guid>(), It.IsAny <bool>())).ReturnsAsync(() => null);

            var ensureSingleActivePackageTypePerUserUseCase = new EnsureSingleActivePackageTypePerUserUseCase(_carePackageGateway.Object);

            _useCase = new UpdateCarePackageUseCase(
                Mapper, _dbManager.Object, _carePackageGateway.Object,
                _carePackageSettingsGateway.Object, ensureSingleActivePackageTypePerUserUseCase, _createPackageResourceUseCase.Object);
        }
Beispiel #4
0
        public void ShouldFailWhenUserHasActivePackage()
        {
            var packageId     = Guid.NewGuid();
            var serviceUserId = Guid.NewGuid();
            var packageType   = PackageType.NursingCare;

            _carePackageGateway
            .Setup(g => g.GetServiceUserActivePackagesCount(serviceUserId, packageType, packageId))
            .ReturnsAsync(1);

            var useCase = new EnsureSingleActivePackageTypePerUserUseCase(_carePackageGateway.Object);

            useCase
            .Invoking(uc => uc.ExecuteAsync(serviceUserId, packageType, packageId))
            .Should().Throw <ApiException>()
            .Where(ex => ex.StatusCode == StatusCodes.Status500InternalServerError);
        }
Beispiel #5
0
        public AssignCarePlanUseCaseTests()
        {
            var getServiceUseUseCaseMock = new Mock <IGetServiceUserUseCase>();

            getServiceUseUseCaseMock
            .Setup(uc => uc.GetServiceUserInformation(It.IsAny <int>()))
            .ReturnsAsync(() => new ServiceUserResponse
            {
                Id = UserConstants.DefaultApiUserGuid
            });

            _carePackageGatewayMock = new Mock <ICarePackageGateway>();
            _dbManagerMock          = new Mock <IDatabaseManager>();

            var fileStorageMock = new Mock <IFileStorage>();
            var ensureSingleActivePackageTypePerUserUseCase = new EnsureSingleActivePackageTypePerUserUseCase(_carePackageGatewayMock.Object);

            _useCase = new AssignCarePlanUseCase(
                getServiceUseUseCaseMock.Object, _carePackageGatewayMock.Object,
                ensureSingleActivePackageTypePerUserUseCase,
                _dbManagerMock.Object, fileStorageMock.Object);
        }