Пример #1
0
        public void Process_PrintsAllRecordsIfFilterIsNull()
        {
            const int recordCount = 3;
            var readerMock = new PresidentsRecordReaderMock(InputFilepath, recordCount);

            var controller = new Controller(readerMock, _viewFactoryMock.Object);

            controller.Process(InputFilepath, null, "text");

            Assert.That(_renderedResult.TotalCount, Is.EqualTo(recordCount));
            Assert.That(_renderedResult.Records, Is.EquivalentTo(readerMock.AccessedRecords));
        }
Пример #2
0
        public void Process_IgnoresFirstLineIfInvalid()
        {
            const int recordCount = 3;
            var readerMock = new PresidentsRecordReaderMock(InputFilepath, 3, includeHeaders: true);

            var controller = new Controller(readerMock, _viewFactoryMock.Object);

            controller.Process(InputFilepath, "president-2-homeState", "text");

            Assert.That(_renderedResult.TotalCount, Is.EqualTo(recordCount));
            Assert.That(_renderedResult.Records.Count(), Is.EqualTo(1));
            Assert.That(_renderedResult.Records,
                Is.EquivalentTo(readerMock.AccessedRecords.Skip(1+1).Take(1)));
        }
Пример #3
0
        public void Process_FiltersPresdinetsByState()
        {
            const int recordCount = 3;
            var readerMock = new PresidentsRecordReaderMock(InputFilepath, recordCount);

            var controller = new Controller(readerMock, _viewFactoryMock.Object);

            controller.Process(InputFilepath, "president-2-homeState", "text");

            Assert.That(_renderedResult.TotalCount, Is.EqualTo(recordCount));
            Assert.That(_renderedResult.Records.Count(), Is.EqualTo(1));
            Assert.That(_renderedResult.Records,
                Is.EquivalentTo(readerMock.AccessedRecords.Skip(1).Take(1)));
        }