示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldFailExtractingLongArrayWhereAnyValueIsEmpty()
        internal virtual void ShouldFailExtractingLongArrayWhereAnyValueIsEmpty()
        {
            // GIVEN
            Extractors extractors = new Extractors(';');

            long[] longData = new long[] { 112233, 4455, 66778899 };
            string data     = ToString(longData, ';') + ";";

            // WHEN extracting long[] from "<number>;<number>...;" i.e. ending with a delimiter
            assertThrows(typeof(System.FormatException), () => extractors.LongArray().extract(data.ToCharArray(), 0, data.Length, false));
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldExtractEmptyLongArrayForEmptyArrayString()
        internal virtual void ShouldExtractEmptyLongArrayForEmptyArrayString()
        {
            // GIVEN
            Extractors extractors = new Extractors(',');
            string     value      = "";

            // WHEN
            Extractor <long[]> extractor = extractors.LongArray();

            extractor.Extract(value.ToCharArray(), 0, value.Length, false);

            // THEN
            assertEquals(0, extractor.Value().Length);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldParseDefaultRelationshipFileHeaderCorrectly() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldParseDefaultRelationshipFileHeaderCorrectly()
        {
            // GIVEN
            CharSeeker seeker     = seeker(":START_ID\t:END_ID\ttype:TYPE\tdate:long\tmore:long[]");
            IdType     idType     = IdType.Actual;
            Extractors extractors = new Extractors('\t');

            // WHEN
            Header header = DataFactories.DefaultFormatRelationshipFileHeader().create(seeker, _tabs, idType, _groups);

            // THEN
            assertArrayEquals(array(Entry(null, Type.StartId, idType.extractor(extractors)), Entry(null, Type.EndId, idType.extractor(extractors)), Entry("type", Type.Type, extractors.String()), Entry("date", Type.Property, extractors.Long_()), Entry("more", Type.Property, extractors.LongArray())), header.Entries());
            seeker.Dispose();
        }