public void TestGetNextPostcodeBatchCalled26Times()
        {
            var reader = new Mock<AreasReader>(MockBehavior.Strict);
            reader.Setup(x => x.GetAllPostCodeParentAreasStartingWithLetter(It.IsAny<string>()))
                .Returns(new List<PostcodeParentAreas>());

            var provider = new PostcodeProvider(reader.Object);
            while (provider.AreMorePostcodes)
            {
                var postcodes = provider.GetNextPostcodeBatch();
            }

            reader.Verify(x => x.GetAllPostCodeParentAreasStartingWithLetter(It.IsAny<string>()), Times.Exactly(26));
        }
 private void IndexPostcodes(IndexWriter writer)
 {
     var postcodeProvider = new PostcodeProvider(areasReader);
     while (postcodeProvider.AreMorePostcodes)
     {
         var postcodes = postcodeProvider.GetNextPostcodeBatch();
         foreach (PostcodeParentAreas postcode in postcodes)
         {
             IndexPostcode(postcode, writer);
         }
     }
 }