コード例 #1
0
        public void BadSignature()
        {
            ReportStart();

            string[] files = Directory.GetFiles(Directory.GetCurrentDirectory());
            foreach (string file in files)
            {
                Stream s     = File.Open(file, FileMode.Open);
                byte[] bytes = new byte[3];
                s.Read(bytes, 0, 3);
                s.Close();

                StringBuilder sb = new StringBuilder();
                foreach (byte b in bytes)
                {
                    sb.Append((char)b);
                }
                if (sb.ToString() != "GIF")
                {
                    _decoder = new GifDecoder(file);
                    _decoder.Decode();
                    Assert.AreEqual(true,
                                    _decoder.TestState(ErrorState.BadSignature),
                                    file + ": " + _decoder.ConsolidatedState);
                }
            }
            ReportEnd();
        }
コード例 #2
0
        public void BadSignature()
        {
            ReportStart();

            string[] files = Directory.GetFiles( Directory.GetCurrentDirectory() );
            foreach( string file in files )
            {
                Stream s = File.Open( file, FileMode.Open );
                byte[] bytes = new byte[3];
                s.Read( bytes, 0, 3 );
                s.Close();

                StringBuilder sb = new StringBuilder();
                foreach( byte b in bytes )
                {
                    sb.Append( (char) b );
                }
                if( sb.ToString() != "GIF" )
                {
                    _decoder = new GifDecoder( file );
                    _decoder.Decode();
                    Assert.AreEqual( true,
                                     _decoder.TestState( ErrorState.BadSignature ),
                                     file + ": " + _decoder.ConsolidatedState );
                }
            }
            ReportEnd();
        }