コード例 #1
0
        /// <summary>
        /// Creates a deep copy of the given object.
        /// </summary>
        public override IFormat Clone()
        {
            var other = new PathSingleValueFormat(Name);

            other.Path        = Path;
            other.ValueFormat = new ValueFormat(ValueFormat);

            return(other);
        }
コード例 #2
0
ファイル: PathSingleValueFormat.cs プロジェクト: bg0jr/Maui
        /// <summary>
        /// Creates a deep copy of the given object.
        /// </summary>
        public override IFormat Clone()
        {
            var other = new PathSingleValueFormat( Name );

            other.Path = Path;
            other.ValueFormat = new ValueFormat( ValueFormat );

            return other;
        }
コード例 #3
0
        public void Clone()
        {
            var format = new PathSingleValueFormat( "Ariva.Symbol" );
            format.Path = @"/BODY[0]/DIV[4]/DIV[0]/DIV[3]/DIV[2]";
            format.ValueFormat = new ValueFormat( typeof( int ), "00000000", new Regex( @"Symbol: (\W+)" ) );

            var clone = (PathSingleValueFormat)format.Clone();

            Assert.AreEqual( format.Name, clone.Name );
            Assert.AreEqual( format.Path, clone.Path );
            Assert.AreEqual( format.ValueFormat, format.ValueFormat );
        }
コード例 #4
0
ファイル: HtmlDocumentTest.cs プロジェクト: bg0jr/Maui
        public void WpknFromAriva()
        {
            var inputFile = OS.CombinePaths( TestDataRoot, "Recognition", "Core", "ariva.overview.US0138171014.html" );
            var doc = myWebScrapSC.GetDocument( new Navigation( DocumentType.Html, inputFile ) );

            var format = new PathSingleValueFormat( "Ariva.Wpkn" );
            format.Path = @"/BODY[0]/DIV[4]/DIV[0]/DIV[3]/DIV[0]";
            format.ValueFormat = new ValueFormat( typeof( int ), "00000000", new Regex( @"WKN: (\d+)" ) );

            var table = doc.ExtractTable( format );

            Assert.AreEqual( 1, table.Rows.Count );

            Assert.AreEqual( 850206, table.Rows[ 0 ][ 0 ] );
        }