public void search_by_empty_criteria()
 {
     var request = new SearchProvidersRequest();
     var response = DoSearch(request);
     Assert.IsNotNull(response.Results);
     Assert.AreEqual(12, response.TotalRecords);
     Assert.AreEqual(12, response.Results.Count());
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Determines whether the specified <see cref="SearchProvidersRequest" /> is equal to this instance.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns></returns>
 public bool Equals(SearchProvidersRequest other)
 {
     return base.Equals(other)
         && PhilosophyOfCareCharacterLimit == other.PhilosophyOfCareCharacterLimit
         && string.Equals(WebUrl, other.WebUrl, StringComparison.OrdinalIgnoreCase)
         && string.Equals(RadiusUnit, other.RadiusUnit, StringComparison.OrdinalIgnoreCase)
         && SearchRadius == other.SearchRadius
         && CurrentLatitude == other.CurrentLatitude
         && CurrentLongitude == other.CurrentLongitude;
 }
        public void search_by_specialtyid_and_provider_name()
        {
            var request = new SearchProvidersRequest
            {
                SpecialtyIds = new[] { "1" },
                ProviderName = "Jane"
            };

            var response = DoSearch(request);

            Assert.AreEqual(1, response.Results.Count());

            Assert.IsTrue(response.Results.ElementAt(0).FullName.Contains(request.ProviderName));
            Assert.IsTrue(response.Results.ElementAt(0).SpecialtiesDescription.Contains("Cardiology"));
        }
        public void search_by_customFields()
        {
            //Arrange
            var request = new SearchProvidersRequest
            {
                ProviderName = "test1",
                UseNameAsKeyword = true
            };

            //Act
            var response = DoSearch(request);

            //Assert
            Assert.AreEqual(12, response.Results.Count());
            Assert.IsTrue(response.Results.ElementAt(0).Custom1.Contains(request.ProviderName));
        }
        public void SearchByNameCombinations([Values(
			"john",
			"doe",
			"dr. john e doe m. d."
			)]string name)
        {
            var request = new SearchProvidersRequest { ProviderName = name };

            var response = DoSearch(request);

            Assert.AreEqual(1, response.Results.Count());
            string fullName = response.Results.ElementAt(0).FullName.ToUpperInvariant();
            Assert.IsTrue(fullName.Contains("DR."));
            Assert.IsTrue(fullName.Contains("JOHN"));
            Assert.IsTrue(fullName.Contains("E"));
            Assert.IsTrue(fullName.Contains("DOE"));
            Assert.IsTrue(fullName.Contains("M. D."));
        }
Ejemplo n.º 6
0
        private void PopulateDefaultQuery(SearchProvidersRequest searchRequest)
        {
            var sorting = GetDropDownValue("Sorting");
            if (!string.IsNullOrEmpty(sorting))
            {
                if (sorting == "Random")
                    searchRequest.RandomSortSeed = GetRandomSortSeed();
                else if (sorting == "Alphabetical")
                    searchRequest.ForceAlphabetizeResults = true;
            }

            var acceptingNewPatients = GetDropDownValue("AcceptingNewPatients");
            if (!string.IsNullOrEmpty(acceptingNewPatients) && acceptingNewPatients != "All")
                searchRequest.IsAcceptingNewPatients = bool.Parse(acceptingNewPatients);
            else
                searchRequest.IsAcceptingNewPatients = null;

            var conditionFilterOption = _viewSettings.GetDropdownSettingValue("Condition");
            if (conditionFilterOption.Value != null)
                searchRequest.ConditionIds = new List<string>() { conditionFilterOption.Value.ToString() };

            var genderFilterOption = _viewSettings.GetDropdownSettingValue("Gender");
            if (genderFilterOption.Value != null)
                searchRequest.GenderId = int.Parse(genderFilterOption.Value.ToString());

            var insuranceFilterOption = _viewSettings.GetDropdownSettingValue("Insurance");
            if (insuranceFilterOption.Value != null)
                searchRequest.InsuranceId = int.Parse(insuranceFilterOption.Value.ToString());

            var langaugeFilterOption = _viewSettings.GetDropdownSettingValue("Language");
            if (langaugeFilterOption.Value != null)
                searchRequest.LanguageIds = new List<string>() { langaugeFilterOption.Value.ToString() };

            var locationFilterOption = _viewSettings.GetDropdownSettingValue("Location");
            if (locationFilterOption.Value != null)
                searchRequest.OrgUnitId = int.Parse(locationFilterOption.Value.ToString());

            var providerTypeOption = _viewSettings.GetDropdownSettingValue("ProviderType");
            if (providerTypeOption.Value != null)
                searchRequest.ProviderTypeIds = new List<string> { providerTypeOption.Value.ToString() };

            var searchRadius = _viewSettings.GetDropdownSettingValue("SearchWithin");
            if (searchRadius.Value != null)
            {
                if (searchRadius.ToString() != "Any")
                    searchRequest.SearchRadius = int.Parse(searchRadius.Value.ToString());
            }

            var specialtyFilterOption = _viewSettings.GetDropdownSettingValue("Specialty");
            if (specialtyFilterOption.Value != null)
                searchRequest.SpecialtyIds = new List<string>() { specialtyFilterOption.Value.ToString() };

            var clinicalInterestOption = _viewSettings.GetDropdownSettingValue("ClinicalInterest");
            if (clinicalInterestOption.Value != null)
                searchRequest.ClinicalInterestIds = new List<string>() { clinicalInterestOption.Value.ToString() };

            var city = _viewSettings.GetSettingValue("City", string.Empty);
            if (!string.IsNullOrEmpty(city))
                searchRequest.City = city;

            var keyword = _viewSettings.GetSettingValue("Keyword", string.Empty);
            if (!string.IsNullOrEmpty(keyword))
                searchRequest.Keyword = keyword;

            var providerName = _viewSettings.GetSettingValue("ProviderName", string.Empty);
            if (!string.IsNullOrEmpty(providerName))
                searchRequest.ProviderName = providerName;
        }
Ejemplo n.º 7
0
        private SearchProvidersRequest BuildRequest(IDictionary<string, string> parameters, int pageSize, int pageNumber)
        {
            var searchRequest = new SearchProvidersRequest()
            {
                PageSize = pageSize,
                RequestedPage = pageNumber,
                RandomSortSeed = GetRandomSortSeed()
            };

            //Location Context
            searchRequest.OrgUnitId = LocationContextHelper.ResolveLocationContext(_view, _viewSettings, parameters).Id;
            searchRequest.DescendantOption = LocationContextHelper.ResolveLocationDescendantOption(_viewSettings, parameters);

            //Default Query Value Overrides
            PopulateDefaultQuery(searchRequest);

            //Query String Overrides
            //Provider
            if (parameters.ContainsKey("ProviderId"))
                searchRequest.ProviderId = int.Parse(parameters["ProviderId"]);
            if (parameters.ContainsKey("ProviderText"))
                searchRequest.ProviderName = parameters["ProviderText"];
            //Keyword
            if (parameters.ContainsKey("Keyword"))
                searchRequest.Keyword = parameters["Keyword"];
            //Gender
            if (parameters.ContainsKey("Gender"))
                searchRequest.GenderId = int.Parse(parameters["Gender"]);
            //Specialty
            if (parameters.ContainsKey("SpecialtyId"))
                searchRequest.SpecialtyIds = new List<string> { parameters["SpecialtyId"] };
            if (parameters.ContainsKey("SpecialtyText"))
                searchRequest.SpecialtyName = parameters["SpecialtyText"];
            //Condition
            if (parameters.ContainsKey("ConditionId"))
                searchRequest.ConditionIds = new List<string> { parameters["ConditionId"] };
            if (parameters.ContainsKey("ConditionText"))
                searchRequest.ConditionName = parameters["ConditionText"];
            //Insurance
            if (parameters.ContainsKey("InsuranceId"))
                searchRequest.InsuranceId = int.Parse(parameters["InsuranceId"]);
            if (parameters.ContainsKey("InsuranceText"))
                searchRequest.InsuranceName = parameters["InsuranceText"];
            //Language
            if (parameters.ContainsKey("LanguageId"))
                searchRequest.LanguageIds = new List<string> { parameters["LanguageId"] };
            if (parameters.ContainsKey("LanguageText"))
                searchRequest.LanguageName = parameters["LanguageText"];
            //Location
            if (parameters.ContainsKey("LocationId"))
                searchRequest.FilteringOrgUnitIds = new List<string> { parameters["LocationId"] };
            if (parameters.ContainsKey("LocationText"))
                searchRequest.OrgUnitName = parameters["LocationText"];
            //City
            if (parameters.ContainsKey("CityId"))
                searchRequest.City = parameters["CityId"];
            //State
            if (parameters.ContainsKey("StateId"))
                searchRequest.State = parameters["StateId"];
            //Postal Code
            if (parameters.ContainsKey("PostalCode"))
                searchRequest.PostalCode = parameters["PostalCode"];
            //Search Radius
            if (parameters.ContainsKey("RadiusDistance") && !string.IsNullOrEmpty(parameters["RadiusDistance"]))
                searchRequest.SearchRadius = int.Parse(parameters["RadiusDistance"]);
            //Accpeting New Patients
            if (parameters.ContainsKey("OnlyAcceptingNewPatients"))
                searchRequest.IsAcceptingNewPatients = bool.Parse(parameters["OnlyAcceptingNewPatients"]) ? true : new bool?();
            //Clincical Interest
            if (parameters.ContainsKey("ClinicalInterestId"))
                searchRequest.ClinicalInterestIds = new List<string> { parameters["ClinicalInterestId"] };
            if (parameters.ContainsKey("ClinicalInterestText"))
                searchRequest.ClinicalInterestName = parameters["ClinicalInterestText"];
            //Provider Type
            if (parameters.ContainsKey("ProviderTypeId"))
                searchRequest.ProviderTypeIds = new List<string> { parameters["ProviderTypeId"] };
            if (parameters.ContainsKey("ProviderTypeText"))
                searchRequest.ProviderTypeName = parameters["ProviderTypeText"];
            //Letter Alpha Search
            if (parameters.ContainsKey("Letter"))
                searchRequest.Letter = parameters["Letter"];
            //Dynamic Column Filtering
            if (parameters.Any(p => p.Key.StartsWith(Constants.DynamicColumnPrefix)))
            {
                var dynamicFilters = new List<string>();
                foreach (var item in parameters.Where(p => p.Key.StartsWith(Constants.DynamicColumnPrefix)))
                {
                    dynamicFilters.Add(item.Value);
                }
                searchRequest.DynamicColumns = dynamicFilters;
            }

            return searchRequest;
        }
        public void search_by_specialty_id()
        {
            var request = new SearchProvidersRequest { SpecialtyIds = new[] { "1" } };

            var response = DoSearch(request);

            Assert.AreEqual(2, response.Results.Count());
            foreach (var provider in response.Results)
            {
                Assert.IsTrue(provider.SpecialtiesDescription.Contains("Cardiology"));
            }
        }
 private SearchProvidersResponse DoSearch(SearchProvidersRequest request)
 {
     var handler = CreateHandler();
     return HandleRequest<SearchProvidersResponse>(handler, request);
 }
        public void test_provider_phone_fax_number()
        {
            var request = new SearchProvidersRequest
            {
                SpecialtyIds = new[] { "1" },
                ProviderName = "Jane"
            };
            var response = DoSearch(request);

            var p = response.Results.FirstOrDefault();

            //Provider Phone and Fax
            Assert.AreEqual("705-555-1234", p.Phone);
            Assert.AreEqual("705-555-2345", p.Fax);
        }
 public void search_with_postalcode_getdistances()
 {
     var request = new SearchProvidersRequest
     {
         PostalCode = "35209"
     };
     var response = DoSearch(request);
     Assert.IsNotNull(response.Results);
     Assert.AreEqual(12, response.TotalRecords);
     Assert.AreEqual(12, response.Results.Count());
     Assert.AreEqual(Convert.ToInt32(response.Results.Single(p => p.Id == 1).MostProximateLocationDistance), 1806);
     Assert.IsNull(response.Results.Single(p => p.Id == 2).MostProximateLocationDistance);
     Assert.AreEqual(Convert.ToInt32(response.Results.Single(p => p.Id == 11).MostProximateLocationDistance), 1806);
 }
        public void Search_Specialty_By_StartsWith_Pattern()
        {
            var request = new SearchProvidersRequest
            {
                SpecialtyName = "Cardi",
                SearchPattern = ProviderSearchPattern.StartsWith,
            };

            //Act
            var response = DoSearch(request);

            //Assert
            Assert.AreEqual(2, response.Results.Count());
            Assert.IsTrue(response.Results.ElementAt(0).SpecialtiesDescription.StartsWith(request.SpecialtyName));
        }
        public void search_randomized()
        {
            var request = new SearchProvidersRequest
            {
                PageSize = 2,
                RequestedPage = 1,
                RandomSortSeed = 1
            };

            var response = DoSearch(request);

            Assert.AreEqual(2, response.Results.Count());
            Assert.AreEqual(12, response.TotalRecords);
            var firstRecordFullName = response.Results.FirstOrDefault().FullName;

            var request2 = new SearchProvidersRequest { PageSize = 2, RequestedPage = 1, RandomSortSeed = 2 };

            var response2 = DoSearch(request2);

            Assert.AreEqual(2, response2.Results.Count());
            Assert.AreEqual(12, response2.TotalRecords);
        }
        public void search_paginated()
        {
            var request = new SearchProvidersRequest
            {
                PageSize = 2,
                RequestedPage = 1
            };

            var response = DoSearch(request);

            Assert.AreEqual(2, response.Results.Count());
            Assert.AreEqual(12, response.TotalRecords);
        }
        public void Search_Name_By_StartsWith_Pattern()
        {
            var request = new SearchProvidersRequest
            {
                ProviderName = "Dr. Ja",
                SearchPattern = ProviderSearchPattern.StartsWith,
                UseNameAsKeyword = false
            };

            //Act
            var response = DoSearch(request);

            //Assert
            Assert.AreEqual(2, response.Results.Count());
            Assert.IsTrue(response.Results.ElementAt(0).FullName.StartsWith(request.ProviderName));
            Assert.IsTrue(response.Results.ElementAt(0).FirstName == "Jane");
        }