//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailGetFileContentAsStreamWithGarbageAsFilename() public virtual void shouldFailGetFileContentAsStreamWithGarbageAsFilename() { try { IoUtil.fileAsStream("asd123"); fail("Expected: IoUtilException"); } catch (IoUtilException) { // happy path } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getFileContentAsStream() public virtual void getFileContentAsStream() { Stream stream = IoUtil.fileAsStream(TEST_FILE_NAME); StreamReader reader = new StreamReader(stream); StringBuilder output = new StringBuilder(); string line; try { while (!string.ReferenceEquals((line = reader.ReadLine()), null)) { output.Append(line); } assertThat(output.ToString()).isEqualTo("This is a Test!"); } catch (Exception) { fail("Something went wrong while reading the input stream"); } }