public void TestFilteredServicesByKeyword()
        {
            //setup

            var Handler = CreateHandler();
            var request = new ServicesSearchRequest();
            request.KeyWord = "d";
            request.ServiceId = -1;
            //act
            var response = HandleRequest<ServicesSearchResponse>(Handler, request);

            //assert
            Assert.IsNotNull(response);

            var responseEnumerator = response.Results.GetEnumerator();
            responseEnumerator.MoveNext();
            ServiceDto results = responseEnumerator.Current;
            var name = results.Name;

            //check service contains letter 'd'

            foreach (var item in response.Results)
            {
                StringAssert.Contains("Ultra Sound", item.Name);
            }

            //check orgunitid comes under Keyword 'd'

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

            //check service doesn't contain under keyword 'd'

            Assert.IsFalse(name.Contains("Xray"));
        }
        public void ListFilteredServicesByKeyword()
        {
            //setup
            var Handler = CreateHandler();
            var Request = new ServicesSearchRequest();

             Request.KeyWord = "D";
            //act
            var response = HandleRequest<ServicesSearchResponse>(Handler, Request);

             //assert
            Assert.IsNotNull(response);

            var responseEnumerator = response.Results.GetEnumerator();
            responseEnumerator.MoveNext();
            ServiceDto results = responseEnumerator.Current;
            var name = results.Name;
            //check service contains letter 'D'

            //check service does't contain under keyword 'D'

            Assert.IsFalse(name.Contains("BP"));
            Assert.IsFalse(name.Contains("Xray"));
            Assert.IsFalse(name.Contains("Boans"));
        }
        public void TestFilteredServicesByCity()
        {
            //setup
            var handler = CreateHandler();
            var request = new ServicesSearchRequest();
            request.City = "Birmingham";

            //act
            var response = HandleRequest<ServicesSearchResponse>(handler, request);

            //assert
            Assert.IsNotNull(response);
            var responseEnumerator = response.Results.GetEnumerator();
            responseEnumerator.MoveNext();
            ServiceDto results = responseEnumerator.Current;
            var name = results.Name;

            //check services under 'Birmingham' city

            Assert.AreEqual("MRI", name);

            //check services doesn't contain under 'Birmingham' city

            Assert.IsFalse(name.Contains("Kidny"));
            Assert.IsFalse(name.Contains("Ultra Sound"));
        }
        public void FilteredOrgunitByOrgUnitTypeId()
        {
            //setup
            var handler = CreateHandler();
            var request = new ServicesSearchRequest();
            request.OrgUnitTypeId = 1;

            //act
            var response = HandleRequest<ServicesSearchResponse>(handler, request);

            //assert
            Assert.IsNotNull(response);
        }
        public void FilteredServicesByOrgUnitId()
        {
            //setup
            var handler = CreateHandler();
            var request = new ServicesSearchRequest();
            //request.OrgUnitId = 1;
            request.OrgUnitTypeId = 1;

            //act
            var response = HandleRequest<ServicesSearchResponse>(handler, request);

            //assert
            Assert.IsNotNull(response);

            var responseEnumerator = response.Results.GetEnumerator();
            responseEnumerator.MoveNext();
            ServiceDto results = responseEnumerator.Current;
            var name = results.Name;

            //check for services under orgunit id '1'
            //Assert.Contains("Xray",response
        }
        public void TestServiceById()
        {
            var handler = CreateHandler();
            var request = new ServicesSearchRequest();
            request.ServiceId = 1;
            request.ForceAlphabetizeResults = false;
            var response = HandleRequest<ServicesSearchResponse>(handler, request);

            var responseEnumerator = response.Results.GetEnumerator();
            responseEnumerator.MoveNext();
            ServiceDto results = responseEnumerator.Current;
            var name = results.Name;
            var nooflocations = results.Numberoflocations;
            //Assert
            Assert.IsNotNull(response);
            //check for services under serviceid '1'
            Assert.AreEqual("Ultra Sound", name);

            //check for services doesn't contain  under serviceid '1'
            Assert.IsFalse(name.Contains("Xray"));
            Assert.IsFalse(name.Contains("Imaging"));

            //check for no of locations under serviceid '1'
            Assert.AreEqual(1, nooflocations);

            //check for city name under serviceid '1'
            Assert.AreEqual("Solvang", results.Serviceorgunits[0].City);

            //check for Address under serviceid '1'
            Assert.AreEqual("Solvang, California", results.Serviceorgunits[0].Address);

            //check for State under serviceid '1'
            Assert.AreEqual("California", results.Serviceorgunits[0].State);

            //check for Address under ServiceorgunitId '1'
            Assert.AreEqual(7, results.Serviceorgunits[0].Id);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Determines whether the specified <see cref="ServicesSearchRequest" /> is equal to this instance.
 /// </summary>
 /// <param name="other">The other.</param>      
 public bool Equals(ServicesSearchRequest other)
 {
     return base.Equals(other)
         && DescendantOption == other.DescendantOption
         && Enumerable.SequenceEqual(FilteringOrgUnitIds ?? new string[] { }, other.FilteringOrgUnitIds ?? new string[] { })
         && LinkedOption == other.LinkedOption
         && OrgUnitId == other.OrgUnitId
         && OrgUnitTypeId == other.OrgUnitTypeId
         && string.Equals(Postalcode, other.Postalcode)
         && string.Equals(City, other.City, StringComparison.OrdinalIgnoreCase)
         && string.Equals(State, other.State, StringComparison.OrdinalIgnoreCase)
         && string.Equals(Keyword, other.Keyword, StringComparison.OrdinalIgnoreCase)
         && ForceAlphabetizeResults == other.ForceAlphabetizeResults
         && Latitude == other.Latitude
         && Longitude == other.Longitude;
 }
        public void TestFilteredServicesByState()
        {
            //setup
            var handler = CreateHandler();
            var request = new ServicesSearchRequest();
            request.State = "California";

            //act
            var response = HandleRequest<ServicesSearchResponse>(handler, request);
            //assert
            Assert.IsNotNull(response);

            var responseEnumerator = response.Results.GetEnumerator();
            responseEnumerator.MoveNext();
            ServiceDto results = responseEnumerator.Current;
            var name = results.Name;

            //check services under california state

            foreach (var item in response.Results)
            {
                StringAssert.Contains("BP", item.Name);
            }

            //check services doesn't contain under california state

            Assert.IsFalse(name.Contains("Xray"));
            Assert.IsFalse(name.Contains("Ultra Sound"));
            Assert.IsFalse(name.Contains("Kidny"));
        }
        public void TestFilteredServicesByPostalCode()
        {
            //setup
            var handler = CreateHandler();
            var request = new ServicesSearchRequest();
            request.Postalcode = "35124";
            //act
            var response = HandleRequest<ServicesSearchResponse>(handler, request);
            //assert
            Assert.IsNotNull(response);

            var responseEnumerator = response.Results.GetEnumerator();
            responseEnumerator.MoveNext();
            ServiceDto results = responseEnumerator.Current;
            var name = results.Name;

            //check services under postal code '35124'

            Assert.AreEqual("MRI", name);

            //check services doesn't contain under postal code '35124'

            Assert.IsFalse(name.Contains("Kidny"));
            Assert.IsFalse(name.Contains("Boans"));
        }
        public void TestFilteredServicesByOrgUnitId()
        {
            //setup
            var handler = CreateHandler();
            var request = new ServicesSearchRequest();
            request.OrgUnitId = 7;

            //act
            var response = HandleRequest<ServicesSearchResponse>(handler, request);

            //assert
            Assert.IsNotNull(response);

            var responseEnumerator = response.Results.GetEnumerator();
            responseEnumerator.MoveNext();
            ServiceDto results = responseEnumerator.Current;
            var name = results.Name;

            //check for services under orgunit id '7'
            foreach (var item in response.Results)
            {
                StringAssert.Contains("BP", item.Name);
            }

            //check services id comes under orgunit id '7'

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

            //check for services doesn't contain under orgunit id '7'

            Assert.IsFalse(name.Contains("Ultra Sound"));
            Assert.IsFalse(name.Contains("Xray"));
            Assert.IsFalse(name.Contains("Boans"));
        }
Exemplo n.º 11
0
        private ServicesSearchRequest BuildRequest(IDictionary<string, string> parameters, int pageSize, int pageNumber)
        {
            var searchRequest = new ServicesSearchRequest()
            {
                PageSize = pageSize,
                RequestedPage = pageNumber
            };

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

            if (parameters.ContainsKey("Keyword"))
                searchRequest.Keyword = parameters["Keyword"];

            if (parameters.ContainsKey("CityText"))
                searchRequest.City = parameters["CityText"];

            if (parameters.ContainsKey("StateText"))
                searchRequest.State = parameters["StateText"];

            if (parameters.ContainsKey("PostalCode"))
                searchRequest.Postalcode = parameters["PostalCode"];

            return searchRequest;
        }