public void CanDownloadFile()
        {
            var staffController = new PersonController( _personService );

            var actionResult = staffController.DownloadReport();

            Assert.IsNotNull( actionResult );
            var fileContentResult = actionResult as FileContentResult;
            Assert.That( fileContentResult.FileContents, Is.Not.Empty, "File is empty" );
            Assert.That( fileContentResult.FileDownloadName, Is.Not.Empty, "File name is empty" );
        }
        public void CanFiltePersonsByStatus(
            bool? isActive,
            int expectedResultCount )
        {
            var staffController = new PersonController( _personService );

            var result = staffController.List( isActive, null, null ) as ViewResult;

            Assert.IsNotNull( result );
            var personModel = result.Model as PersonListModel;
            Assert.IsNotNull( personModel );
            Assert.That( personModel.Persons.Count, Is.EqualTo( expectedResultCount ) );
        }
        public void CanDoPagedPersonSearch(
            int pageNumber,
            int pageSize,
            int expectedTotalPages,
            int[] expextedPersonIds )
        {
            var staffController = new PersonController( _personService );

            var result = staffController.List( null, pageNumber, pageSize ) as ViewResult;

            Assert.IsNotNull( result );
            var personModel = result.Model as PersonListModel;
            Assert.IsNotNull( personModel );
            Assert.That(
                personModel.Persons.PageCount,
                Is.EqualTo( expectedTotalPages ),
                "Total pages count is not as expected" );
            Assert.That(
                personModel.Persons.Count,
                Is.EqualTo( expextedPersonIds.Length ),
                string.Format( "Expected persons ids are {0}", expextedPersonIds.JoinAsStrings( ";" ) ) );
        }