public void Get_InvalidNullId()
        {
            var controller = new BinaryController(_pointerService, _apiSettings);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = HttpContexts.Valid_Search;

            var nodeServices = new Mock <INodeServices>();

            nodeServices.Setup(x => x.InvokeAsync <byte[]>(It.IsAny <string>(), It.IsAny <object[]>())).Returns(Task.Run(() => Encoding.UTF8.GetBytes("I'm a PDF!")));

            Assert.ThrowsAsync <HttpFhirException>(async() => await controller.Get(nodeServices.Object, null, "mhcp"));
        }
        public async void Get_OkPdf()
        {
            var controller = new BinaryController(_pointerService, _apiSettings);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = HttpContexts.Valid_Search;

            var nodeServices = new Mock <INodeServices>();

            nodeServices.Setup(x => x.InvokeAsync <byte[]>(It.IsAny <string>(), It.IsAny <object[]>())).Returns(Task.Run(() => Encoding.UTF8.GetBytes("I'm a PDF!")));

            var response = await controller.Get(nodeServices.Object, "5a82f9ffcb969daa58d33377", "mhcp");

            Assert.IsType <FileContentResult>(response);

            var responseContent = response as FileContentResult;

            Assert.Equal(Encoding.UTF8.GetBytes("I'm a PDF!"), responseContent.FileContents);
            Assert.Equal("application/pdf", responseContent.ContentType);
        }
        public async void Get_OkFhir()
        {
            var controller = new BinaryController(_pointerService, _apiSettings);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = HttpContexts.Valid_DocumentFhir;

            var nodeServices = new Mock <INodeServices>();

            nodeServices.Setup(x => x.InvokeAsync <byte[]>(It.IsAny <string>(), It.IsAny <object[]>())).Returns(Task.Run(() => Encoding.UTF8.GetBytes("I'm a PDF!")));

            var response = await controller.Get(nodeServices.Object, "5a82f9ffcb969daa58d33377", "mhcp");

            Assert.IsType <FileContentResult>(response);

            var responseContent = response as FileContentResult;

            Assert.Equal(Encoding.UTF8.GetBytes("{\"resourceType\":\"Binary\",\"contentType\":\"application/pdf\",\"content\":\"SSdtIGEgUERGIQ==\"}"), responseContent.FileContents);
            Assert.Equal("application/xml+fhir; charset=utf-8", responseContent.ContentType);
        }