public NrlsControllerTests()
        {
            var nrlsSettingsMock = new Mock <IOptionsSnapshot <NrlsApiSetting> >();

            nrlsSettingsMock.Setup(op => op.Get(It.IsAny <string>())).Returns(AppSettings.NrlsApiSettings);

            var pointerList = new List <DocumentReference> {
                NrlsPointers.Valid, NrlsPointers.Valid_With_Alt_Custodian
            };

            var searchMock = new Mock <INrlsSearch>();

            //searchMock.Setup(x => x.Find<DocumentReference>(It.IsAny<FhirRequest>())).Returns(System.Threading.Tasks.Task.FromResult(FhirBundle.GetBundle(pointerList) as Resource));
            searchMock.Setup(x => x.Find(It.Is <FhirRequest>(y => y.RequestingAsid == "000"))).Returns(System.Threading.Tasks.Task.FromResult(FhirBundle.GetBundle(pointerList)));
            searchMock.Setup(x => x.Get(It.Is <FhirRequest>(y => y.RequestingAsid == "000"))).Returns(System.Threading.Tasks.Task.FromResult(NrlsPointers.Valid as Resource));
            searchMock.Setup(x => x.Get(It.Is <FhirRequest>(y => y.RequestingAsid == "notfound"))).Returns(System.Threading.Tasks.Task.FromResult(null as Resource));
            searchMock.Setup(x => x.Get(It.Is <FhirRequest>(y => y.RequestingAsid == "inactive"))).Returns(System.Threading.Tasks.Task.FromResult(NrlsPointers.Valid_Superseded as Resource));

            var maintMock = new Mock <INrlsMaintain>();

            //maintMock.Setup(x => x.Find<DocumentReference>(It.IsAny<FhirRequest>())).Returns(System.Threading.Tasks.Task.FromResult(new Bundle() as Resource));
            maintMock.Setup(x => x.Delete(It.Is <FhirRequest>(y => y.RequestingAsid == "fromASID"))).Returns(System.Threading.Tasks.Task.FromResult(OperationOutcomes.Deleted));
            maintMock.Setup(x => x.Delete(It.Is <FhirRequest>(y => y.RequestingAsid == "badrequest"))).Returns(System.Threading.Tasks.Task.FromResult(OperationOutcomes.Invalid));
            maintMock.Setup(x => x.Delete(It.Is <FhirRequest>(y => y.RequestingAsid == "notfound"))).Returns(System.Threading.Tasks.Task.FromResult(OperationOutcomes.NotFound));

            maintMock.Setup(x => x.Patch(It.Is <FhirRequest>(y => y.RequestingAsid == "fromASID"))).Returns(System.Threading.Tasks.Task.FromResult(OperationOutcomes.Updated));
            maintMock.Setup(x => x.Patch(It.Is <FhirRequest>(y => y.RequestingAsid == "badrequest"))).Returns(System.Threading.Tasks.Task.FromResult(OperationOutcomes.Invalid));
            maintMock.Setup(x => x.Patch(It.Is <FhirRequest>(y => y.RequestingAsid == "badquery"))).Throws(new HttpFhirException("Invalid", OperationOutcomes.Invalid, HttpStatusCode.BadRequest));
            maintMock.Setup(x => x.Patch(It.Is <FhirRequest>(y => y.RequestingAsid == "notfound"))).Returns(System.Threading.Tasks.Task.FromResult(OperationOutcomes.NotFound));

            _nrlsSettings = nrlsSettingsMock.Object;
            _nrlsSearch   = searchMock.Object;
            _nrlsMaintain = maintMock.Object;
        }
 public NrlsController(IOptionsSnapshot <ApiSetting> apiSettings, INrlsSearch nrlsSearch, INrlsMaintain nrlsMaintain)
 {
     _nrlsSearch      = nrlsSearch;
     _nrlsMaintain    = nrlsMaintain;
     _nrlsApiSettings = apiSettings.Get("NrlsApiSetting");
 }
 public void Dispose()
 {
     _nrlsSettings = null;
     _nrlsSearch   = null;
     _nrlsMaintain = null;
 }