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( ";" ) ) ); }
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 ) ); }