예제 #1
0
        public void Test_HISearchMedicareNumber()
        {
            IResourceServiceOutcomeFactory IResourceServiceOutcomeFactory = CommonTestSetup.TestSetupMocks.GetIResourceServiceOutcomeFactory();
            IPyroFhirUriFactory            IPyroFhirUriFactory            = CommonTestSetup.TestSetupMocks.GetIPyroFhirUriFactory();
            IResourceServices     IResourceServices     = GetIResourceServices();
            IGlobalProperties     IGlobalProperties     = CommonTestSetup.TestSetupMocks.GetIGlobalProperties();
            IHiServiceApi         IHiServiceApi         = GetMokIHiServiceApi();
            IMedicareNumberParser IMedicareNumberParser = new MedicareNumberParser();
            IIndividualHealthcareIdentifierParser IIndividualHealthcareIdentifierParser = new IndividualHealthcareIdentifierParser();
            IDVANumberParser    IDVANumberParser   = new DVANumberParser();
            IRequestMetaFactory RequestMetaFactory = CommonTestSetup.TestSetupMocks.GetIRequestMetaFactory();
            INationalHealthcareIdentifierInfo INationalHealthcareIdentifierInfo = new NationalHealthcareIdentifierInfo();
            IMedicareNumberInfo IMedicareNumberInfo = new MedicareNumberInfo();

            Common.PyroHealthFhirResource.CodeSystems.IPyroFhirServer IPyroFhirServerCodeSystem = new Common.PyroHealthFhirResource.CodeSystems.PyroFhirServer();


            IHISearchOrValidateOperation IHISearchOrValidateOperationService = new IHISearchOrValidateOperation(
                IResourceServiceOutcomeFactory,
                IResourceServices,
                IGlobalProperties,
                IHiServiceApi,
                RequestMetaFactory,
                IMedicareNumberParser,
                IIndividualHealthcareIdentifierParser,
                IDVANumberParser,
                INationalHealthcareIdentifierInfo,
                IMedicareNumberInfo,
                IPyroFhirServerCodeSystem);

            OperationClass OperationClass = new OperationClass()
            {
                Scope = Common.Enum.FhirOperationEnum.OperationScope.Resource,
                Type  = Common.Enum.FhirOperationEnum.OperationType.xIHISearchOrValidate
            };

            //var SearchParameterGeneric = new Common.Search.SearchParameterGeneric();

            var PyroRequestUri = CommonTestSetup.TestSetupMocks.GetIPyroRequestUriFactory().CreateFhirRequestUri();

            PyroRequestUri.FhirRequestUri = CommonTestSetup.TestSetupMocks.GetIPyroRequestUriFactory().CreateFhirRequestUri().FhirRequestUri = new Pyro.Common.Tools.UriSupport.PyroFhirUri(CommonTestSetup.TestSetupMocks.GetIPrimaryServiceRootCache());
            PyroRequestUri.FhirRequestUri.Parse($"{StaticTestData.FhirEndpoint()}/{ResourceType.Patient.GetLiteral()}/{Common.Enum.FhirOperationEnum.OperationType.xIHISearchOrValidate.GetPyroLiteral()}");
            IRequestMeta RequestMeta = RequestMetaFactory.CreateRequestMeta();

            RequestMeta.PyroRequestUri         = PyroRequestUri;
            RequestMeta.RequestHeader          = CommonTestSetup.TestSetupMocks.GetIRequestHeaderFactory().CreateRequestHeader();
            RequestMeta.SearchParameterGeneric = CommonTestSetup.TestSetupMocks.GetISearchParameterGenericFactory().CreateDtoSearchParameterGeneric();

            Parameters ParametersResource = GenerateRequestParametersResource();

            IResourceServiceOutcome ResourceServiceOutcome = IHISearchOrValidateOperationService.IHISearchOrValidate(
                OperationClass,
                ParametersResource,
                RequestMeta
                );

            Assert.NotNull(ResourceServiceOutcome.ResourceResult);
            Assert.AreEqual(ResourceType.Parameters.GetLiteral(), ResourceServiceOutcome.ResourceResult.TypeName);
        }
예제 #2
0
        public void Test_GenerateRandomIHI()
        {
            IIndividualHealthcareIdentifierGenerator Generator = new IndividualHealthcareIdentifierGenerator();
            string NewRandom = Generator.Generate();
            IIndividualHealthcareIdentifier       IHI;
            IIndividualHealthcareIdentifierParser Parser = new IndividualHealthcareIdentifierParser();

            Assert.IsTrue(Parser.TryParse(NewRandom, out IHI));
        }
예제 #3
0
        public void Test_IHI_IsValid_False()
        {
            //037 should be 036
            string Value = "8003708333428779";
            IIndividualHealthcareIdentifier       IHI;
            IIndividualHealthcareIdentifierParser Parser = new IndividualHealthcareIdentifierParser();

            Assert.IsFalse(Parser.TryParse(Value, out IHI));
        }
예제 #4
0
        public void Test_IHI_IsValid_True()
        {
            string Value = "8003608333428779";
            IIndividualHealthcareIdentifier       IHI;
            IIndividualHealthcareIdentifierParser Parser = new IndividualHealthcareIdentifierParser();

            Assert.IsTrue(Parser.TryParse(Value, out IHI));
            Assert.AreEqual("80", IHI.IndustryCode);
            Assert.AreEqual("036", IHI.CountryCode);
            Assert.AreEqual("0", IHI.NumberIssuerCode);
            Assert.AreEqual("833342877", IHI.UniqueReference);
            Assert.AreEqual("9", IHI.CheckDigit);
            Assert.AreEqual(Value, IHI.Value);
        }