public void Test_07_TestGetExtension( ) { FileFilters filter = new FileFilters( ); string filters = ( "Word (*.doc)|*.doc|WordX (*.docx)|*.docx||" ); filter.PopulateCollections( filters ); Assert.AreEqual( ".doc", filter.GetExtension( 0 ) ); Assert.AreEqual( ".docx", filter.GetExtension( 1 ) ); Assert.AreEqual( "should throw IndexOutOfRangeExctption", filter.GetExtension( 2 ) ); }
public void Test_06_TestCreateRegularExpression( ) { FileFilters filter = new FileFilters( ); string filters = ( "Documents (*.docx; *.doc)|*.docx; *.doc||" ); filter.PopulateCollections( filters ); filter.CreateRegularExpressions( ); Regex regex = filter[ 0 ]; Assert.AreEqual( @"(.+\.docx$)|(.+\.doc$)", regex.ToString( ) ); }