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); }
public static IDtoRootUrlStore GetIDtoRootUrlStore() { Mock <IDtoRootUrlStore> MokIDtoRootUrlStore = new Mock <IDtoRootUrlStore>(); MokIDtoRootUrlStore.Setup(x => x.Id).Returns(1); MokIDtoRootUrlStore.Setup(x => x.IsServersPrimaryUrlRoot).Returns(true); MokIDtoRootUrlStore.Setup(x => x.RootUri).Returns(new Uri(StaticTestData.FhirEndpoint())); MokIDtoRootUrlStore.Setup(x => x.Url).Returns(StaticTestData.FhirEndpoint()); return(MokIDtoRootUrlStore.Object); }
public static IGlobalProperties GetIGlobalProperties() { Mock <IGlobalProperties> MokIGlobalProperties = new Mock <IGlobalProperties>(); MokIGlobalProperties.Setup(x => x.HIServiceConnectivityActive).Returns(true); MokIGlobalProperties.Setup(x => x.NumberOfRecordsPerPageDefault).Returns(50); MokIGlobalProperties.Setup(x => x.MaxNumberOfRecordsPerPage).Returns(100); MokIGlobalProperties.Setup(x => x.ServiceBaseURL).Returns(StaticTestData.FhirEndpoint()); return(MokIGlobalProperties.Object); }
/// <summary> /// Setup the mocked pyro ResourceService which mocks the response from the Pyro database when commiting the /// SoapRequest and SoapResponse FHIR Binary resources /// </summary> /// <returns></returns> private IResourceServices GetIResourceServices() { var FhirRequestUriForBinaryRequestPut = CommonTestSetup.TestSetupMocks.GetIPyroRequestUriFactory().CreateFhirRequestUri().FhirRequestUri = new Pyro.Common.Tools.UriSupport.PyroFhirUri(CommonTestSetup.TestSetupMocks.GetIPrimaryServiceRootCache()); FhirRequestUriForBinaryRequestPut.Parse($"{StaticTestData.FhirEndpoint()}/{ResourceType.Binary.GetLiteral()}/{SoapRequestId}"); Mock <IResourceServiceOutcome> MokIResourceServiceOutcomeOne = new Mock <IResourceServiceOutcome>(); MokIResourceServiceOutcomeOne.Setup(x => x.FhirResourceId).Returns(SoapRequestId); MokIResourceServiceOutcomeOne.Setup(x => x.FormatMimeType).Returns((string)null); MokIResourceServiceOutcomeOne.Setup(x => x.HttpStatusCode).Returns(System.Net.HttpStatusCode.Created); MokIResourceServiceOutcomeOne.Setup(x => x.IsDeleted).Returns(false); MokIResourceServiceOutcomeOne.Setup(x => x.LastModified).Returns(DateTimeOffset.Now); MokIResourceServiceOutcomeOne.Setup(x => x.OperationType).Returns(RestEnum.CrudOperationType.Create); MokIResourceServiceOutcomeOne.Setup(x => x.RequestUri).Returns(FhirRequestUriForBinaryRequestPut); MokIResourceServiceOutcomeOne.Setup(x => x.ResourceResult).Returns(new Binary()); MokIResourceServiceOutcomeOne.Setup(x => x.ResourceVersionNumber).Returns("1"); MokIResourceServiceOutcomeOne.Setup(x => x.SuccessfulTransaction).Returns(true); MokIResourceServiceOutcomeOne.Setup(x => x.SummaryType).Returns((Hl7.Fhir.Rest.SummaryType?)null); var FhirRequestUriForBinaryResponsePut = CommonTestSetup.TestSetupMocks.GetIPyroRequestUriFactory().CreateFhirRequestUri().FhirRequestUri = new Pyro.Common.Tools.UriSupport.PyroFhirUri(CommonTestSetup.TestSetupMocks.GetIPrimaryServiceRootCache()); FhirRequestUriForBinaryRequestPut.Parse($"{StaticTestData.FhirEndpoint()}/{ResourceType.Binary.GetLiteral()}/{SoapResponseId}"); Mock <IResourceServiceOutcome> MokIResourceServiceOutcomeTwo = new Mock <IResourceServiceOutcome>(); MokIResourceServiceOutcomeTwo.Setup(x => x.FhirResourceId).Returns(SoapResponseId); MokIResourceServiceOutcomeTwo.Setup(x => x.FormatMimeType).Returns((string)null); MokIResourceServiceOutcomeTwo.Setup(x => x.HttpStatusCode).Returns(System.Net.HttpStatusCode.Created); MokIResourceServiceOutcomeTwo.Setup(x => x.IsDeleted).Returns(false); MokIResourceServiceOutcomeTwo.Setup(x => x.LastModified).Returns(DateTimeOffset.Now); MokIResourceServiceOutcomeTwo.Setup(x => x.OperationType).Returns(RestEnum.CrudOperationType.Create); MokIResourceServiceOutcomeTwo.Setup(x => x.RequestUri).Returns(FhirRequestUriForBinaryResponsePut); MokIResourceServiceOutcomeTwo.Setup(x => x.ResourceResult).Returns(new Binary()); MokIResourceServiceOutcomeTwo.Setup(x => x.ResourceVersionNumber).Returns("1"); MokIResourceServiceOutcomeTwo.Setup(x => x.SuccessfulTransaction).Returns(true); MokIResourceServiceOutcomeTwo.Setup(x => x.SummaryType).Returns((Hl7.Fhir.Rest.SummaryType?)null); Mock <IResourceServices> MokIResourceServices = new Mock <IResourceServices>(); MokIResourceServices.SetupSequence(x => x.Put(It.IsAny <string>(), It.IsAny <Binary>(), It.IsAny <IRequestMeta>())) .Returns(MokIResourceServiceOutcomeOne.Object) .Returns(MokIResourceServiceOutcomeTwo.Object); MokIResourceServices.SetReturnsDefault <IResourceServiceOutcome>(MokIResourceServiceOutcomeOne.Object); return(MokIResourceServices.Object); }
static void Main(string[] args) { Logger.Open(0); // no default logging _output = Logger.Out; // FIX:? Logger.WriteLine(Version); var options = OptionParser.Create(_options, _help); if (!options.Parse(args)) { return; } // trigger options here to avoid having to change debug conditions if (_xdebug) { //options.Parse(new string[] { @"..\UnityPlayer\Test Puzzles\ascripttest.txt", "/2", "/input=right" }); options.Parse(new string[] { "/33", "/input=right" }); //options.Parse(new string[] { @"..\UnityPlayer\Puzzles\new\2048.txt", "/2", "/input=level 3,left" }); //options.Parse(new string[] { @"..\UnityPlayer\puzzles\New\333.txt", "/2", "/input=tick" }); //options.Parse(new string[] { @"..\UnityPlayer\puzzles\New\fifteen.txt", "/2", "/input=fire1 28" }); //options.Parse(new string[] { @".\demo\threes.txt", "/0", "/input=up,down,left,right", "/endl" }); //options.Parse(new string[] { "/jta", "testdata.json", "/f=collapse simple", "/0" }); //options.Parse(new string[] { "/3" }); //options.Parse(new string[] { @"..\UnityPlayer\\Assets\Resources\Puzzles\yasban.txt", "/2", }); //options.Parse(new string[] { @"..\UnityPlayer\Test Puzzles\Buggy\threes.txt", "/3", }); //options.Parse(new string[] { @"..\UnityPlayer\Puzzles\new\colour wheel.txt", "/3", }); //options.Parse(new string[] { @"..\UnityPlayer\Puzzles\new\loops_of_zen.txt", "/3", "/level=1", "/input=init" }); //options.Parse(new string[] { @".\jsonconvert\085-Sok7.txt", "/2" }); //options.Parse(new string[] { "/3", "/input=action,right,right,left,right" }); //options.Parse(new string[] { @".\test puzzles\basicloop.txt", "/502", "/input=right" }); //options.Parse(new string[] { @".\test puzzles\rigid.txt", "/502", "/input=right,right,right,down,right" }); //options.Parse(new string[] { @".\test puzzles\laserblock.txt", "/3", "/input=right" }); //options.Parse(new string[] { @"..\UnityPlayer\Assets\Resources\New Puzzles\loops_of_zen.txt", "/3", "/input=fire1 12" }); //options.Parse(new string[] { @".\test puzzles\input_click.txt", "/503", "/input=hover 2" }); //options.Parse(new string[] { @"..\UnityPlayer\test puzzles\New\loops_of_zen.txt", "/3", "/input=fire1 12" }); //options.Parse(new string[] { @".\test puzzles\ellipsisnodup.txt", "/403", "/input=right", "/endl" }); //options.Parse(new string[] { @".\jsonconvert\117-Rigidbody fix bug #246.txt", "/201", "/input=up,up" }); //options.Parse(new string[] { "/jct", "/0" }); //options.Parse(new string[] { @".\demo\collapse.txt", "/403", "/lev=3", "/input=up,right,right,right" }); //options.Parse(new string[] { @".\test puzzles\ellipsisdrag.txt", "/403", "/input=right", "/endl" }); //options.Parse(new string[] { @".\test puzzles\ellipsisfill.txt", "/403", "/input=right", "/endl" }); //options.Parse(new string[] { @".\demo\tiny treasure hunt.txt", "/2", "/input=action,action,action", "/endl" }); //options.Parse(new string[] { @".\demo\microban.txt", "/2", "/input=action,action,action", "/endl" }); //options.Parse(new string[] { @".\demo\dropswap.txt", "/2", "/input=action,action,action", "/endl" }); //options.Parse(new string[] { @"randwater.txt", "/2", "/input=left", "/tim" }); //options.Parse(new string[] { @"rose.txt", "/1", "/input=action", "/tim" }); //options.Parse(new string[] { @".\demo\byyourside.txt", "/2", "/input=action", "/endl" }); //options.Parse(new string[] { @".\demo\atlas shrank.txt", "/2", "/input=action", "/endl" }); //options.Parse(new string[] { @".\gistrename\vertebrae.txt", "/2", "/input=action,tick,input=action,tick" }); //options.Parse(new string[] { @".\gistrename\watch your step.txt", "/2", "/input=action,tick,input=action,tick" }); //options.Parse(new string[] { "/gcon", "/2" }); //options.Parse(new string[] { "/gist", "/2" }); //options.Parse(new string[] { @".\demo\cratopia.txt", "/301", "/input=action,action,right,left" }); //options.Parse(new string[] { @".\demo\whaleworld.txt", "/301", "/input=action,up" }); //options.Parse(new string[] { "/jta", "testdata.json", "/f=by your side", "/0" }); //options.Parse(new string[] { "/302", "/input=right,right,right,right" }); //options.Parse(new string[] { "/jta", "testdata.json", "/f=drop swap", "/0" }); //options.Parse(new string[] { "/deb", "/input=right,right" }); //options.Parse(new string[] { "/jta", "testdata.json", "/f=whale", "/0" }); //options.Parse(new string[] { "SimpleBlockPushing.txt", "/301", "/input=action,right" }); //options.Parse(new string[] { "/jts", "testcase.json", "/3" }); //Logger.Level = 301; //_inputs = "right,right"; //_take = 1; //_jtarray = true; //_filter = "explod"; //_jsonarray = true; //_jsonsingle = true; //_xpath = "testcase.json"; //_gist = "0ebbe5e1f0761a87cc7aeace0d5e4b8e"; //_jsonconvert = true; //_dir = true; //path = "2048.txt"; //_encodelevel = true; //path = "../demo/modality.txt"; //path = "../demo/ebony and ivory.txt"; //path = "../demo/cute train.txt"; //path = "../demo/atlas shrank.txt"; } if (_jtarray) { foreach (var path in options.GetPathnames(_xpath ?? "testdata.json")) { RunJsonTests(path, ReadFile(path)); } } else if (_jtsingle) { foreach (var path in options.GetPathnames(_xpath ?? "testcase.json") .Where(p => p.ToLower().Contains(_filter))) { RunJsonTestCase(path, ReadFile(path)); } } else if (_jconvert != null) { foreach (var path in options.GetPathnames(_xpath ?? "testdata.json") .Where(p => p.ToLower().Contains(_filter))) { RunJsonConvert(path, ReadFile(path), _jconvert); } } else if (_jctest != null) { foreach (var file in options.GetPathnames(_xpath ?? "jsonconvert") .Where(p => p.ToLower().Contains(_filter))) { RunJsonConvTest(file); } } else if (_gist != null) { RunGist(_gist); } else if (_urllink != null) { RunUrlLink(_urllink); } else if (_urlquery != null) { RunUrlQuery(_urlquery); } else if (_gconvert != null) { foreach (var filename in options.GetPathnames(_xpath ?? "gists.txt") .Where(p => p.ToLower().Contains(_filter))) { RunGistConvert(filename, _gconvert); } //--- static test data cases ----------------------------------------------- } else if (_static) { //if (_xdebug) _filter = "PRBG"; _output.WriteLine($"Compiling test case: '{_filter}'"); var testcase = StaticTestData.GetTestCase(_filter, "PRBG with winco", "(win):@(rul):[>p|r]->[>p|>r]"); RunScript(_filter, testcase.Script, _inputs, _startlevel); //--- default script ----------------------------------------------- } else { var defaultscript = "testgame.txt"; //if (_xdebug) Logger.Level = 202; //if (_xdebug) _inputs = "right,right,right,down,right"; //if (_xdebug) _inputs = "left,left"; //if (_xdebug) _inputs = "right,right"; //if (_xdebug) defaultscript = "SimpleBlockPushing.txt"; foreach (var path in options.GetPathnames(defaultscript)) //()) { RunScript(path, ReadFile(path), _inputs, _startlevel); } } }
public static IPrimaryServiceRootCache GetIPrimaryServiceRootCache() { Mock <IPrimaryServiceRootCache> MokIPrimaryServiceRootCache = new Mock <IPrimaryServiceRootCache>(); MokIPrimaryServiceRootCache.Setup(x => x.GetPrimaryRootUrlFromDatabase()).Returns(TestSetupMocks.GetIDtoRootUrlStore()); MokIPrimaryServiceRootCache.Setup(x => x.GetPrimaryRootUrlFromWebConfig()).Returns(StaticTestData.FhirEndpoint()); return(MokIPrimaryServiceRootCache.Object); }