private static void CheckDateTimeStamp( DateTimeStamp t ) { string s = t.ToString(); var m = new StringMatcher( "X" + s + "Y" ); Assert.That( m.MatchChar( 'X' ) ); DateTimeStamp parsed; Assert.That( m.MatchDateTimeStamp( out parsed ) && parsed == t ); Assert.That( m.MatchChar( 'Y' ) ); m = new StringMatcher( s.Insert( 2, "X" ) ); Assert.That( m.MatchDateTimeStamp( out parsed ), Is.False ); Assert.That( m.ErrorMessage, Is.Not.Null ); int i; Assert.That( m.MatchInt32( out i ) && i == 20 ); }
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 ); }