public void match_methods_must_set_an_error() { var m = new StringMatcher( "A" ); DateTimeStamp ts; CheckMatchError( m, () => m.MatchDateTimeStamp( out ts ) ); DateTime dt; CheckMatchError( m, () => m.MatchFileNameUniqueTimeUtcFormat( out dt ) ); CheckMatchError( m, () => m.MatchText( "B" ) ); }
public void matching_FileNameUniqueTimeUtcFormat() { DateTime t = DateTime.UtcNow; string s = t.ToString( FileUtil.FileNameUniqueTimeUtcFormat ); var m = new StringMatcher( "X" + s + "Y" ); Assert.That( m.MatchChar( 'X' ) ); DateTime parsed; Assert.That( m.MatchFileNameUniqueTimeUtcFormat( out parsed ) && parsed == t ); Assert.That( m.MatchChar( 'Y' ) ); m = new StringMatcher( s.Insert( 2, "X" ) ); Assert.That( m.MatchFileNameUniqueTimeUtcFormat( out parsed ), Is.False ); int i; Assert.That( m.MatchInt32( out i ) && i == 20 ); }