Esempio n. 1
0
        public void ParserWillParseAddress()
        {
            var addressFormat1 = "1 street road";
            var resFormat1     = _parseService.Parse(addressFormat1);

            Assert.IsNotNull(resFormat1);
            Assert.IsTrue(resFormat1.StreetNumber == "1");
            Assert.IsTrue(resFormat1.StreetName == "street road");

            var addressFormat2 = "1b road street";
            var resFormat2     = _parseService.Parse(addressFormat2);

            Assert.IsNotNull(resFormat2);
            Assert.IsTrue(resFormat2.StreetNumber == "1b");
            Assert.IsTrue(resFormat2.StreetName == "road street");
        }
        public IEnumerable <AddressEntry> Sort(IEnumerable <ContactEntry> contacts)
        {
            if (contacts == null || contacts.Count() == 0)
            {
                throw new ArgumentException("List of contacts cannot be null or empty");
            }

            var parsedAddressList = parser.Parse(contacts.Select(x => x.Address).ToList());

            return(parsedAddressList.OrderBy(x => x.StreetName));
        }