コード例 #1
0
ファイル: ReadablesTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailWhenThereAreMoreThanOneSuitableFileInThere() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailWhenThereAreMoreThanOneSuitableFileInThere()
        {
            // GIVEN
            string text       = "abcdefghijlkmnopqrstuvxyz";
            File   compressed = CompressWithZip(text, ".nothing", ".DS_Store", "somewhere/something");

            // WHEN
            CharReadable readable;

            try
            {
                readable = Readables.Files(Charset.defaultCharset(), compressed);
                fail("Should fail since there are multiple suitable files in the zip archive");
            }
            catch (IOException e)
            {               // Good
                assertThat(e.Message, containsString("Multiple"));
            }
        }
コード例 #2
0
ファイル: ReadablesTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void shouldComplyWithSpecifiedCharset(java.nio.charset.Charset charset) throws Exception
        private void ShouldComplyWithSpecifiedCharset(Charset charset)
        {
            // GIVEN
            string data = "abcåäö[]{}";
            File   file = WriteToFile(data, charset);

            // WHEN
            CharReadable        reader = Readables.Files(charset, file);
            SectionedCharBuffer buffer = new SectionedCharBuffer(100);

            buffer = reader.Read(buffer, buffer.Front());

            // THEN
            char[] expected = data.ToCharArray();
            char[] array    = buffer.Array();
            assertEquals(expected.Length, buffer.Available());
            for (int i = 0; i < expected.Length; i++)
            {
                assertEquals(expected[i], array[buffer.Pivot() + i]);
            }
        }
コード例 #3
0
ファイル: ReadablesTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertReadText(java.io.File file, String text) throws java.io.IOException
        private void AssertReadText(File file, string text)
        {
            AssertReadText(Readables.Files(Charset.defaultCharset(), file), text);
        }