コード例 #1
0
        public void GivenPostOfficeDataFile_WhenReadCalled_ShouldReadDataOnOver1500000PostOffices()
        {
            var file        = new PostOfficeDataFile();
            var postOffices = file.Read();

            Assert.That(postOffices.Count(), Is.GreaterThan(150000));
        }
コード例 #2
0
        public void GivenPostOfficeDataFile_WhenReadCalled_FirstItemShouldHaveCorrectName()
        {
            var file            = new PostOfficeDataFile();
            var postOffices     = file.Read();
            var firstPostOffice = postOffices.First();

            Assert.That(firstPostOffice, Is.EqualTo("Achalapur B.O"));
        }
コード例 #3
0
        public void GivenTreeBasedAndSimpleCompleters_WhenLookupCalled_TreeBasedShouldBeFaster()
        {
            var testData = new PostOfficeDataFile();

            var treeBasedPostOfficeNameCompleter = new TreeBasedPostOfficeNameCompleter(testData.Read());
            var timeForTreeBasedLookup           = Time(() => treeBasedPostOfficeNameCompleter.SuggestCompletedNames("Acha"));

            var simplePostOfficeNameCompleter = new SimplePostOfficeNameCompleter(testData.Read());
            var timeForSimpleLookup           = Time(() => simplePostOfficeNameCompleter.SuggestCompletedNames("Acha"));

            Console.WriteLine("Simple lookup took {0}", timeForSimpleLookup);
            Console.WriteLine("Tree based lookup took {0}", timeForTreeBasedLookup);
            Assert.That(timeForSimpleLookup, Is.GreaterThan(timeForTreeBasedLookup));
        }