Exemplo n.º 1
0
        public ActionResult SearchCity(string searchString)
        {
            CityFinder  cf   = new CityFinder();
            ICityResult cres = cf.Search(searchString);

            return(View(cres.NextCities.ToList().ToString()));
        }
Exemplo n.º 2
0
        public void TestCitiesGivenEmptyString()
        {
            //arrange
            string      searchTerm = "";
            ICityResult city       = new CityResult();

            for (int i = 0; i < 1000000; i++)
            {
                city.NextCities.Add(i.ToString());
            }

            city.NextCities.Add("BANDUNG");
            city.NextCities.Add("BANGUI");
            city.NextCities.Add("BANGKOK");
            city.NextCities.Add("BANGALORE");
            city.NextCities.Add("LA PAZ");
            city.NextCities.Add("LA PLATA");
            city.NextCities.Add("LAGOS");
            city.NextCities.Add("LEEDS");
            city.NextCities.Add("ZARIA");
            city.NextCities.Add("ZHUGHAI");
            city.NextCities.Add("ZIBO");

            ICityFinder finder = new CityFinder();

            //act
            var result = finder.Search(searchTerm);

            //assert
            CollectionAssert.AreEqual(city.NextCities.ToList(), result.NextCities.ToList());
        }
Exemplo n.º 3
0
 public void Setup()
 {
     //Setup fake resources
     citiesData = new SortedDictionary <string, IDictionary <DictionaryKeys, ICollection <string> > >();
     citiesData.Add("a", new Dictionary <DictionaryKeys, ICollection <string> >());
     citiesData["a"][DictionaryKeys.Cities] = new List <string> {
         "abby", "adom", "azeeza"
     };
     citiesData["a"][DictionaryKeys.Letters] = new List <string> {
         "b", "d", "z"
     };
     citiesData.Add("b", new Dictionary <DictionaryKeys, ICollection <string> >());
     citiesData["b"][DictionaryKeys.Cities] = new List <string> {
         "babby", "badom", "bazeeza"
     };
     citiesData["b"][DictionaryKeys.Letters] = new List <string> {
         "a"
     };
     citiesData.Add("c", new Dictionary <DictionaryKeys, ICollection <string> >());
     citiesData["c"][DictionaryKeys.Cities] = new List <string> {
         "cabby", "cadom", "cazeeza"
     };
     citiesData["c"][DictionaryKeys.Letters] = new List <string> {
         "a"
     };
     cityFinder = new CityFinder(citiesData);
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please Insert Search Term...");

            string searchTerm = Console.ReadLine();

            ICityRepository cityRepo   = new CityRepository();
            ICityFinder     cityFinder = new CityFinder(cityRepo);

            ICityResult cityResult = cityFinder.Search(searchTerm);

            int cityCount      = cityResult.NextCities.Count;
            int characterCount = cityResult.NextLetters.Count;

            Console.WriteLine($"Given Search Term {searchTerm}");
            Console.WriteLine($"Found {cityCount} Cities.");
            if (cityCount > 0)
            {
                foreach (string city in cityResult.NextCities)
                {
                    Console.WriteLine($"{city}");
                }
            }
            ;
            Console.WriteLine();
            Console.WriteLine($"Found {characterCount} Characters.");
            if (characterCount > 0)
            {
                foreach (string letter in cityResult.NextLetters)
                {
                    Console.WriteLine($"{letter}");
                }
            }
            Console.WriteLine("Finished Search.");
        }
Exemplo n.º 5
0
        public void SearchTest()
        {
            APIKey      apiKey  = new APIKey("AIzaSyC3evyffluu_gsQxMJq0ljpCrsFdfldLoM"); //TODO Use using here for efficiency
            CityFinder  finder  = new CityFinder(apiKey);
            ICityResult results = (CityResult)finder.Search("mid");

            ICollection <string> nextLetters = new List <string>();
            ICollection <string> nextCities  = new List <string>();

            nextCities.Add("Midland");
            nextCities.Add("Midrand");
            nextCities.Add("Midlothian");
            nextCities.Add("Middlesbrough");
            nextCities.Add("Middletown");

            nextLetters.Add("l");
            nextLetters.Add("r");
            nextLetters.Add("l");
            nextLetters.Add("d");
            nextLetters.Add("d");

            ICityResult testResults = new CityResult(nextLetters, nextCities);

            for (int i = 0; i > nextCities.Count; i++)
            {
                Assert.AreEqual(testResults.NextCities.ElementAt(i), results.NextCities.ElementAt(i));
            }

            for (int i = 0; i > nextLetters.Count; i++)
            {
                Assert.AreEqual(testResults.NextLetters.ElementAt(i), results.NextLetters.ElementAt(i));
            }
        }
Exemplo n.º 6
0
        public void Search_WithSearchString_ZE()
        {
            string searchText = "ZE";

            var expectedCities = new HashSet <string>
            {
            };

            var expectedLetters = new HashSet <string>
            {
            };

            CityFinder  finder     = new CityFinder();
            ICityResult cityResult = finder.Search(searchText);

            Assert.AreEqual(expectedCities.Count, cityResult.NextCities.Count);
            for (var i = 0; i < expectedCities.Count; i++)
            {
                Assert.AreEqual(expectedCities.Contains(searchText), cityResult.NextCities.Contains(searchText));
            }
            Assert.AreEqual(expectedLetters.Count, cityResult.NextLetters.Count);
            for (var i = 0; i < expectedLetters.Count; i++)
            {
                Assert.AreEqual(expectedLetters.Contains(searchText), cityResult.NextLetters.Contains(searchText));
            }
        }
Exemplo n.º 7
0
        private static CityFinder GetFinder(AddressParseContainer container)
        {
            var splitter = new AddressSplitter(container);
            var finder   = new CityFinder(container);

            splitter.SplitAndClean();

            return(finder);
        }
Exemplo n.º 8
0
        public void Search_WithEmptyInput_ThrowException()
        {
            string[] expectedCities = { };
            string[] expectedLetters = { };

            ICityFinder cityFinder = new CityFinder(new MockDataAcess());

            Action result = () => cityFinder.Search("");

            Assert.ThrowsException<Exception>(result);
        }
Exemplo n.º 9
0
        public void Search_ForBang_Return3CitiesWith3NextLetters()
        {
            string[] expectedCities = { "BANGUI", "BANGKOK", "BANGALORE" };
            string[] expectedLetters = { "U", "K", "A" };

            ICityFinder cityFinder = new CityFinder(new MockDataAcess());

            var result = cityFinder.Search("Bang");

            CollectionAssert.AreEqual(expectedLetters, result.NextLetters.ToList());
            CollectionAssert.AreEqual(expectedCities, result.NextCities.ToList());
        }
Exemplo n.º 10
0
        public void Search_ForLa_Return3CitiesWith2NextLetters()
        {
            string[] expectedCities = { "LA PAZ", "LA PLATA", "LAGOS" };
            string[] expectedLetters = { " ", "G" };

            ICityFinder cityFinder = new CityFinder(new MockDataAcess());

            var result = cityFinder.Search("La");

            CollectionAssert.AreEqual(expectedLetters, result.NextLetters.ToList());
            CollectionAssert.AreEqual(expectedCities, result.NextCities.ToList());
        }
Exemplo n.º 11
0
        public void Search_ForBangkok_ReturnBangkokWithNoLetters()
        {
            string[] expectedCities = { "BANGKOK" };
            string[] expectedLetters = { };

            ICityFinder cityFinder = new CityFinder(new MockDataAcess());

            var result = cityFinder.Search("Bangkok");

            CollectionAssert.AreEqual(expectedLetters, result.NextLetters.ToList());
            CollectionAssert.AreEqual(expectedCities, result.NextCities.ToList());
        }
Exemplo n.º 12
0
        public void Search_ForZe_ReturnNoCitesAndNoLetters()
        {
            string[] expectedCities = { };
            string[] expectedLetters = { };

            ICityFinder cityFinder = new CityFinder(new MockDataAcess());

            var result = cityFinder.Search("Ze");

            CollectionAssert.AreEqual(expectedLetters, result.NextLetters.ToList());
            CollectionAssert.AreEqual(expectedCities, result.NextCities.ToList());
        }
Exemplo n.º 13
0
        public CityFinderTests()
        {
            _fixture = new Fixture().Customize(new AutoMoqCustomization()
            {
                ConfigureMembers = true
            });
            _cityListRepositoryMock   = _fixture.Freeze <Mock <ICityListRepository> >();
            _cityNextLetterHelperMock = _fixture.Freeze <Mock <ICityNextLetterHelper> >();
            _cityNameFinderMock       = _fixture.Freeze <Mock <ICityNameFinder> >();
            _validatorMock            = _fixture.Freeze <Mock <IValidator> >();

            _underTest = _fixture.Create <CityFinder>();
        }
Exemplo n.º 14
0
        public ActionResult Index(string searchString)
        {
            CityFinder  cf   = new CityFinder();
            ICityResult cres = cf.Search(searchString);

            if (Request.IsAjaxRequest())
            {
                return(PartialView("PartialSearch", cres));
            }
            else
            {
                return(View(cres));
            }
        }
        public void WithSearchStringBANGK_ShouldReturn_A_O(string searchString)
        {
            ICollection <string> expectedCities = new Collection <string>();

            ICollection <string> expectedLetters = new Collection <string> {
                "A",
                "O",
            };

            ICityResult expect = new CityResult(expectedCities, expectedLetters);

            ICityFinder cityFinder = new CityFinder();
            ICityResult actual     = cityFinder.Search(searchString);

            Assert.IsTrue(expect.NextLetters.SequenceEqual(actual.NextLetters));
        }
Exemplo n.º 16
0
        public void TestLettersGivenFullCity()
        {
            //arrange
            string      searchTerm = "zhughai";
            ICityResult city       = new CityResult();

            city.NextLetters = new Collection <string>()
            {
            };
            ICityFinder finder = new CityFinder();

            //act
            var result = finder.Search(searchTerm);

            //assert
            CollectionAssert.AreEqual(city.NextLetters.ToList(), result.NextLetters.ToList());
        }
Exemplo n.º 17
0
        public void CityFinder_GivenNullCityNameFinder_ExpectException()
        {
            try
            {
                var underTest = new CityFinder(
                    _cityListRepositoryMock.Object,
                    _validatorMock.Object,
                    null,
                    _cityNextLetterHelperMock.Object);

                Assert.Fail("Should have thrown an exception.");
            }
            catch (ArgumentNullException e)
            {
                e.ParamName.Should().BeEquivalentTo("cityNameFinder");
            }
        }
Exemplo n.º 18
0
        public void TestCitiesZe()
        {
            //arrange
            string      searchTerm = "ze";
            ICityResult city       = new CityResult();

            city.NextCities = new Collection <string>()
            {
            };
            ICityFinder finder = new CityFinder();

            //act
            var result = finder.Search(searchTerm);

            //assert
            CollectionAssert.AreEqual(city.NextCities.ToList(), result.NextCities.ToList());
        }
Exemplo n.º 19
0
        public void TestLettersGivenEmptyString()
        {
            //arrange
            string      searchTerm = "";
            ICityResult city       = new CityResult();

            city.NextLetters = new Collection <string>()
            {
                "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "B", "L", "Z"
            };
            ICityFinder finder = new CityFinder();

            //act
            var result = finder.Search(searchTerm);

            //assert
            CollectionAssert.AreEqual(city.NextLetters.ToList(), result.NextLetters.ToList());
        }
Exemplo n.º 20
0
        public void TestCitiesBang()
        {
            //arrange
            string      searchTerm = "bang";
            ICityResult city       = new CityResult();

            city.NextCities = new Collection <string>()
            {
                "BANGUI", "BANGKOK", "BANGALORE"
            };
            ICityFinder finder = new CityFinder();

            //act
            var result = finder.Search(searchTerm);

            //assert
            CollectionAssert.AreEqual(city.NextCities.ToList(), result.NextCities.ToList());
        }
Exemplo n.º 21
0
        public void TestLettersBang()
        {
            //arrange
            string      searchTerm = "bang";
            ICityResult city       = new CityResult();

            city.NextLetters = new Collection <string>()
            {
                "U", "K", "A"
            };
            ICityFinder finder = new CityFinder();

            //act
            var result = finder.Search(searchTerm);

            //assert
            CollectionAssert.AreEqual(city.NextLetters.ToList(), result.NextLetters.ToList());
        }
Exemplo n.º 22
0
        static void Main(string[] args)
        {
            try
            {
                APIKey     apiKey = new APIKey("AIzaSyC3evyffluu_gsQxMJq0ljpCrsFdfldLoM"); //Provide an APIKey for the API
                CityFinder finder = new CityFinder(apiKey);                                //Instantiate a new CityFinder

                Console.Write("Welcome to CitySearch's example implementation.\n" +
                              "Please enter a search string to continue:\n");

                while ("pigs" != "fly")
                {
                    string      searchString = Console.ReadLine();                      //Await user input.
                    ICityResult results      = (CityResult)finder.Search(searchString); //Search the API using the finder, and a search string parameter

                    Console.Write("--------------------\n" +
                                  "Predicted City Names:\n\n");

                    foreach (string city in results.NextCities)
                    {   //Itterate through the cities in the results and write them to console
                        Console.Write("City Name:\t" + city + "\n");
                    }

                    Console.Write("--------------------\n" +
                                  "Predicted Next Letters:\n\n");
                    foreach (string letter in results.NextLetters)
                    {   //Same as as above, but for the next letters.
                        Console.Write("Next Letter:\t" + letter + "\n");
                    }
                    Console.Write("--------------------\n");
                    Console.Write("Enter Another Search :\n");
                }
            }
            catch (Exception e)
            {
                Debug.Write("Program quit unexpectedly: \n", e.Source);
            }
        }
Exemplo n.º 23
0
        static void Main(string[] args)
        {
            // Create CityFinder and store the example cities
            cityFinder = new CityFinder();
            cities     = new List <string>(new string[] { "Abingdon", "Accrington", "Acton", "Adlington", "Alcester", "Aldeburgh", "Aldershot", "Aldridge", "Alford", "Alfreton", "Alnwick", "Alsager", "Alston", "Alton", "Altrincham", "Amble", "Amersham", "Amesbury", "Ampthill", "Andover", "Appleby-in-Westmorland", "Arundel", "Ashbourne", "Ashburton", "Ashby-de-la-Zouch", "Ashford", "Ashington", "Ashton-in-Makerfield", "Ashton-under-Lyne", "Askern", "Aspatria", "Atherstone", "Attleborough", "Axbridge", "Axminster", "Aylesbury", "Aylsha", "Bacup", "Bakewell", "Baldock", "Banbury", "Barking", "Barnard Castle", "Barnet", "Barnoldswick", "Barnsley", "Barnstaple", "Barnt Green", "Barrow-in-Furness", "Barton-upon-Humber", "Barton-le-Clay", "Basildon", "Basingstoke", "Bath", "Batley", "Battle", "Bawtry", "Beaconsfield", "Beaminster", "Bebington", "Beccles", "Bedale", "Bedford", "Bedlington", "Bedworth", "Beeston", "Belper", "Bentham", "Berkhamsted", "Berwick-upon-Tweed", "Beverley", "Bewdley", "Bexhill-on-Sea", "Bicester", "Biddulph", "Bideford", "Biggleswade", "Billericay", "Bilston", "Bingham", "Birmingham", "Bishop Auckland", "Bishop's Castle", "Bishop's Stortford", "Bishop's Waltham", "Blackburn", "Blackpool", "Blandford Forum", "Bletchley", "Blyth", "Bodmin", "Bognor Regis", "Bollington", "Bolsover", "Bolton", "Bordon", "Borehamwood", "Boston", "Bottesford", "Bourne", "Bournemouth", "Brackley", "Bracknell", "Bradford", "Bradford-on-Avon", "Bradley Stoke", "Bradninch", "Braintree", "Brentford", "Brentwood", "Bridgnorth", "Bridgwater", "Bridlington", "Bridport", "Brierley Hill", "Brigg", "Brighouse", "Brightlingsea", "Brighton", "Bristol", "Brixham", "Broadstairs", "Bromley", "Bromsgrove", "Bromyard", "Brownhills", "Buckfastleigh", "Buckingham", "Bude", "Budleigh Salterton", "Bungay", "Buntingford", "Burford", "Burgess Hill", "Burnham-on-Crouch", "Burnham-on-Sea", "Burnley", "Burntwood", "Burton Latimer", "Burton-upon-Trent", "Bury", "Bury St Edmunds", "Buxton", "Blackbur", "Caistor", "Calne", "Camberley", "Camborne", "Cambridge", "Camelford", "Cannock", "Canterbury", "Carlisle", "Carnforth", "Carterton", "Castle Cary", "Castleford", "Chadderton", "Chagford", "Chard", "Charlbury", "Chatham", "Chatteris", "Chelmsford", "Cheltenham", "Chesham", "Cheshunt", "Chester", "Chesterfield", "Chester-le-Street", "Chichester", "Chippenham", "Chipping Campden", "Chipping Norton", "Chipping Ongar", "Chipping Sodbury", "Chorley", "Christchurch", "Church Stretton", "Cinderford", "Cirencester", "Clacton-on-Sea", "Cleckheaton", "Cleethorpes", "Clevedon", "Cleveleys", "Clitheroe", "Clun", "Coalville", "Cockermouth", "Coggeshall", "Colchester", "Coleford", "Colne", "Congleton", "Conisbrough", "Corbridge", "Corby", "Cotgrave", "Coventry", "Cowes", "Cramlington", "Cranfield", "Crawley", "Crayford", "Crediton", "Crewe", "Crewkerne", "Cromer", "Crowborough", "Crowle", "Crowthorne", "Croydon", "Cuckfield", "Cullompton", "connor town", "Dagenham", "Dalton in Furness", "Darley Dale", "Darlington", "Dartford", "Dartmouth", "Darwen", "Daventry", "Dawlish", "Deal", "Denholme", "Denton", "Derby", "Dereham", "Desborough", "Devizes", "Dewsbury", "Didcot", "Dinnington", "Diss", "Doncaster", "Dorchester", "Dorking", "Dover", "Downham Market", "Driffield", "Dronfield", "Droitwich Spa", "Droylsden", "Dudley", "Dukinfield", "Dunstable", "Durham", "Dursley", "Ealing", "Earley", "Easingwold", "Eastbourne", "East Grinstead", "East Ham", "Eastleigh", "Eastwood", "Edenbridge", "Egham", "Ellesmere", "Ellesmere Port", "Ely", "Enfield", "Epping", "Epsom", "Epworth", "Erith", "Esher", "Eton", "Evesham", "Exeter", "Exmouth", "Eye", "Failsworth", "Fairford", "Fakenham", "Falmouth", "Fareham", "Faringdon", "Farnborough", "Farnham", "Farnworth", "Faversham", "Featherstone", "Felixstowe", "Fenny Stratford", "Ferndown", "Ferryhill", "Filey", "Filton", "Fleet", "Fleetwood", "Flitwick", "Folkestone", "Fordingbridge", "Fordwich", "Fowey", "Framlingham", "Frinton-on-Sea", "Frodsham", "Frome", "Foxley", "Gainsborough", "Gateshead", "Gillingham", "Gillingham", "Glastonbury", "Glossop", "Gloucester", "Godalming", "Godmanchester", "Goole", "Gosport", "Grange-over-Sands", "Grantham", "Gravesend", "Grays", "Great Dunmow", "Great Torrington", "Great Yarmouth", "Grimsby", "Guildford", "Guisborough", "Hackney", "Hadleigh", "Hailsham", "Halesworth", "Halewood", "Halifax", "Halstead", "Haltwhistle", "Harlow", "Harpenden", "Harrogate", "Harrow", "Hartlepool", "Harwich", "Haslemere", "Hastings", "Hatfield", "Havant", "Haverhill", "Hawley", "Hayle", "Haywards Heath", "Heanor", "Heathfield", "Hebden Bridge", "Hedon", "Helston", "Hemel Hempstead", "Hemsworth", "Henley-in-Arden", "Henley-on-Thames", "Hendon", "Hereford", "Herne Bay", "Hertford", "Hessle", "Heswall", "Hetton-le-Hole", "Heywood", "Hexham", "Higham Ferrers", "Highworth", "High Wycombe", "Hinckley", "Hitchin", "Hoddesdon", "Holmfirth", "Holsworthy", "Honiton", "Horley", "Horncastle", "Hornsea", "Horsham", "Horwich", "Houghton-le-Spring", "Hounslow", "Hoylake", "Hove", "Hucknall", "Huddersfield", "Hugh Town", "Hull", "Hungerford", "Hunstanton", "Huntingdon", "Hyde", "Hythe", "Ilchester", "Ilford", "Ilfracombe", "Ilkeston", "Ilkley", "Ilminster", "Ipswich", "Irthlingborough", "Ivybridge", "Jarrow", "Keighley", "Kempston", "Kendal", "Kenilworth", "Kesgrave", "Keswick", "Kettering", "Keynsham", "Kidderminster", "Kidsgrove", "Killingworth", "Kimberley", "Kingsbridge", "King's Lynn", "Kingston-upon-Hull", "Kingston upon Thames", "Kington", "Kirkby", "Kirkby-in-Ashfield", "Kirkby Lonsdale", "Kirkham", "Knaresborough", "Knottingley", "Knutsford", "Kingsteignton", "Lancaster", "Launceston", "Leatherhead", "Leamington Spa", "Lechlade", "Ledbury", "Leeds", "Leek", "Leicester", "Leigh", "Leighton Buzzard", "Leiston", "Leominster", "Letchworth", "Lewes", "Lewisham", "Leyland", "Leyton", "Lichfield", "Lincoln", "Liskeard", "Littlehampton", "Liverpool", "Lizard", "London", "London", "Long Eaton", "Longridge", "Looe", "Lostwithiel", "Loughborough", "Loughton", "Louth", "Lowestoft", "Ludlow", "Luton", "Lutterworth", "Lydd", "Lydney", "Lyme Regis", "Lymington", "Lynton", "Lytchett Minster", "Lytham St Annes", "Lofthouse", "Mablethorpe", "Macclesfield", "Maghull", "Maidenhead", "Maidstone", "Maldon", "Malmesbury", "Maltby", "Malton", "Malvern", "Manchester", "Manningtree", "Mansfield", "March", "Margate", "Market Deeping", "Market Drayton", "Market Harborough", "Market Rasen", "Market Weighton", "Marlborough", "Marlow", "Maryport", "Marston Moretaine", "Matlock", "Melksham", "Melton Mowbray", "Mexborough", "Middleham", "Middlesbrough", "Middleton", "Middlewich", "Midhurst", "Midsomer Norton", "Milton Keynes", "Minehead", "Morecambe", "Moretonhampstead", "Moreton-in-Marsh", "Morley", "Morpeth", "Much Wenlock", "Nailsea", "Nailsworth", "Nantwich", "Needham Market", "Nelson", "Neston", "Newark-on-Trent", "Newbiggin-by-the-Sea", "Newbury", "Newcastle-under-Lyme", "Newcastle upon Tyne", "Newent", "Newhaven", "Newmarket", "New Mills", "New Milton", "Newport", "Newport", "Shropshire", "Newport Pagnell", "Newquay", "New Romney", "Newton Abbot", "Newton Aycliffe", "Newton-le-Willows", "Normanton", "Northallerton", "Northam", "Northampton", "North Walsham", "Northwich", "Norton Radstock", "Norwich", "Nottingham", "Nuneaton", "Oakham", "Okehampton", "Oldbury", "Oldham", "Ollerton", "Olney", "Ormskirk", "Orpington", "Ossett", "Oswestry", "Otley", "Ottery St Mary", "Oundle", "Oxford", "Outwood", "Paddock Wood", "Padstow", "Paignton", "Painswick", "Peacehaven", "Penistone", "Penrith", "Penryn", "Penzance", "Pershore", "Peterborough", "Peterlee", "Petersfield", "Petworth", "Pickering", "Plymouth", "Pocklington", "Pontefract", "Polegate", "Poltimore", "Poole", "Portishead", "Portland", "Portslade", "Portsmouth", "Potters Bar", "Potton", "Poulton-le-Fylde", "Prescot", "Preston", "Princes Risborough", "Prudhoe", "Pudsey", "Queenborough", "Quintrell Downs", "Ramsgate", "Raunds", "Rayleigh", "Reading", "Redcar", "Redditch", "Redhill", "Redruth", "Reigate", "Retford", "Richmond", "Richmond-upon-Thames", "Rickmansworth", "Ringwood", "Ripley", "Ripon", "Rochdale", "Rochester", "Rochford", "Romford", "Romsey", "Ross-on-Wye", "Rothbury", "Rotherham", "Rothwell", "Rowley Regis", "Royston", "Rugby", "Rugeley", "Runcorn", "Rushden", "Rutland", "Ryde", "Rye", "Saffron Walden", "Selby", "St Albans", "St Asaph", "St Austell", "St Blazey", "St Columb Major", "St Helens", "St Ives", "Cambridgeshire", "St Ives", "Cornwall", "St Neots", "Salcombe", "Sale", "Salford", "Salisbury", "Saltash", "Saltburn-by-the-Sea", "Sandbach", "Sandhurst", "Sandown", "Sandwich", "Sandy", "Sawbridgeworth", "Saxmundham", "Scarborough", "Scunthorpe", "Seaford", "Seaton", "Sedgefield", "Selby", "Selsey", "Settle", "Sevenoaks", "Shaftesbury", "Shanklin", "Sheerness", "Sheffield", "Shepshed", "Shepton Mallet", "Sherborne", "Sheringham", "Shildon", "Shipston-on-Stour", "Shoreham-by-Sea", "Shrewsbury", "Sidcup", "Sidmouth", "Sittingbourne", "Skegness", "Skelmersdale", "Skipton", "Sleaford", "Slough", "Smethwick", "Snodland", "Soham", "Solihull", "Somerton", "Southall", "Southam", "Southampton", "Southborough", "Southend-on-Sea", "South Molton", "Southport", "Southsea", "South Shields", "Southwell", "Southwold", "South Woodham Ferrers", "Spalding", "Spennymoor", "Spilsby", "Stafford", "Staines", "Stainforth", "Stalybridge", "Stamford", "Stanley", "Stapleford", "Staunton", "Staveley", "Stevenage", "Stockport", "Stocksbridge", "Stockton-on-Tees", "Stoke-on-Trent", "Stone", "Stony Stratford", "Stotfold", "Stourbridge", "Stourport-on-Severn", "Stowmarket", "Stow-on-the-Wold", "Stratford-upon-Avon", "Streatham", "Street", "Strood", "Stroud", "Sudbury", "Sunderland", "Sutton", "Sutton Coldfield", "Sutton-in-Ashfield", "Swadlincote", "Swaffham", "Swanage", "Swanley", "Swindon", "Swinton", "Tadcaster", "Tadley", "Tamworth", "Taunton", "Tavistock", "Teignmouth", "Telford", "Tenbury Wells", "Tenterden", "Tetbury", "Tewkesbury", "Thame", "Thatcham", "Thaxted", "Thetford", "Thirsk", "Thong", "Thornaby", "Thornbury", "Thorne", "Tickhill", "Tilbury", "Tipton", "Tiverton", "Todmorden", "Tonbridge", "Torpoint", "Torquay", "Totnes", "Tottenham", "Totton", "Towcester", "Tring", "Trowbridge", "Truro", "Tunbridge Wells", "Twickenham", "Uckfield", "Ulverston", "Uppingham", "Upton-upon-Severn", "Uttoxeter", "Uxbridge", "Ventnor", "Verwood", "Wadebridge", "Wadhurst", "Wakefield", "Wallasey", "Wallingford", "Walmer", "Walsall", "Waltham Abbey", "Waltham Cross", "Walthamstow", "Walton-on-Thames", "Walton-on-the-Naze", "Wandsworth", "Wantage", "Ware", "Wareham", "Warminster", "Warwick", "Washington", "Watchet", "Watford", "Wath-upon-Dearne", "Watton", "Wednesbury", "Wellingborough", "Wellington", "Wells", "Wells-next-the-Sea", "Welwyn Garden City", "Wem", "Wendover", "West Bromwich", "Westbury", "Westerham", "West Ham", "Westhoughton", "West Kirby", "West Mersea", "Westminster", "Weston-super-Mare", "Westward Ho!", "Wetherby", "Weybridge", "Weymouth", "Whaley Bridge", "Whiston", "Whitby", "Whitchurch", "Whitehaven", "Whitley Bay", "Whitnash", "Whitstable", "Whitworth", "Wickford", "Widnes", "Wigan", "Wigston", "Willenhall", "Wimbledon", "Wimborne Minster", "Wincanton", "Winchcombe", "Winchelsea", "Winchester", "Windermere", "Winsford", "Winslow", "Wisbech", "Witham", "Withernsea", "Witney", "Wivenhoe", "Woburn", "Woking", "Wokingham", "Wolverhampton", "Wombwell", "Woodbridge", "Woodstock", "Wooler", "Woolwich", "Wootton Bassett", "Worcester", "Workington", "Worksop", "Worthing", "Wotton-under-Edge", "Wymondham" });

            foreach (string city in cities)
            {
                cityFinder.Add(city);
            }

            // Start main loop of searching for suggestions and valid next letters.
            string search = "";

            while (true)
            {
                ICityResult result = cityFinder.Search(search);

                DisplayNextCities(result.NextCities);
                DisplayLetters(result.NextLetters);
                search = GetUserInput(result.NextLetters, search);
            }
        }
 public void Setup()
 {
     sut = CreateCityFinderObject();
 }
Exemplo n.º 25
0
 public void Setup()
 {
     //Setup real resources
     realCityData   = new SortedCityData();
     realCityFinder = new CityFinder(realCityData.GetCities());
 }