示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowMissingIdHeaderEntry() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAllowMissingIdHeaderEntry()
        {
            // GIVEN
            CharSeeker seeker     = seeker("one\ttwo");
            Extractors extractors = new Extractors(';');

            // WHEN
            Header header = DataFactories.DefaultFormatNodeFileHeader().create(seeker, _tabs, IdType.Actual, _groups);

            // THEN
            assertArrayEquals(array(Entry("one", Type.Property, extractors.String()), Entry("two", Type.Property, extractors.String())), header.Entries());
            seeker.Dispose();
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveEmptyHeadersBeInterpretedAsIgnored() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHaveEmptyHeadersBeInterpretedAsIgnored()
        {
            // GIVEN
            CharSeeker seeker     = seeker("one:id\ttwo\t\tdate:long");
            IdType     idType     = IdType.Actual;
            Extractors extractors = new Extractors('\t');

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

            // THEN
            assertArrayEquals(array(Entry("one", Type.Id, extractors.Long_()), Entry("two", Type.Property, extractors.String()), Entry(null, Type.Ignore, null), Entry("date", Type.Property, extractors.Long_())), header.Entries());
            seeker.Dispose();
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldParseDefaultNodeFileHeaderCorrectly() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldParseDefaultNodeFileHeaderCorrectly()
        {
            // GIVEN
            CharSeeker seeker     = seeker("ID:ID,label-one:label,also-labels:LABEL,name,age:long");
            IdType     idType     = IdType.String;
            Extractors extractors = new Extractors(',');

            // WHEN
            Header header = DataFactories.DefaultFormatNodeFileHeader().create(seeker, _commas, idType, _groups);

            // THEN
            assertArrayEquals(array(Entry("ID", Type.Id, idType.extractor(extractors)), Entry("label-one", Type.Label, extractors.StringArray()), Entry("also-labels", Type.Label, extractors.StringArray()), Entry("name", Type.Property, extractors.String()), Entry("age", Type.Property, extractors.Long_())), header.Entries());
            seeker.Dispose();
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailOnUnexpectedNodeHeaderType()
        public virtual void ShouldFailOnUnexpectedNodeHeaderType()
        {
            // GIVEN
            CharSeeker seeker = seeker(":ID,:START_ID");
            IdType     idType = IdType.Actual;

            // WHEN
            try
            {
                Header header = DataFactories.DefaultFormatNodeFileHeader().create(seeker, _commas, idType, _groups);
                fail("Should have failed");
            }
            catch (InputException e)
            {
                // THEN
                assertThat(e.Message, containsString("START_ID"));
            }
        }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailForDuplicateIdHeaderEntries() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailForDuplicateIdHeaderEntries()
        {
            // GIVEN
            CharSeeker seeker     = seeker("one:id\ttwo:id");
            IdType     idType     = IdType.Actual;
            Extractors extractors = new Extractors('\t');

            // WHEN
            try
            {
                DataFactories.DefaultFormatNodeFileHeader().create(seeker, _tabs, idType, _groups);
                fail("Should fail");
            }
            catch (DuplicateHeaderException e)
            {
                assertEquals(Entry("one", Type.Id, extractors.Long_()), e.First);
                assertEquals(Entry("two", Type.Id, extractors.Long_()), e.Other);
            }
            seeker.Dispose();
        }