merge from trunk revisions 58933, 58935, 58936
[mono.git] / mcs / class / corlib / Test / System.IO / TextWriterTest.cs
1 //
2 // TextWriterTest.cs
3 //
4 // Author: 
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2004 Novell (http://www.novell.com)
8 //
9
10 using System;
11 using System.Globalization;
12 using System.IO;
13 using System.Text;
14 using NUnit.Framework;
15
16 namespace MonoTests.System.IO
17 {
18         [TestFixture]
19         public class TextWriterTest : Assertion
20         {
21                 class MyTextWriter : TextWriter
22                 {
23                         public override Encoding Encoding { get { return Encoding.Default; } }
24
25                         internal MyTextWriter ()
26                                 : base (CultureInfo.InvariantCulture)
27                         {
28                         }
29
30                         public void UpdateLine ()
31                         {
32                                 CoreNewLine = new char [] {'Z'};
33                         }
34
35                         public void UpdateLine2 ()
36                         {
37                                 CoreNewLine [0] = 'Y';
38                         }
39                 }
40
41                 [Test]
42                 public void CoreNewLine ()
43                 {
44                         MyTextWriter w = new MyTextWriter ();
45                         AssertNotNull (w.NewLine);
46
47                         w.UpdateLine ();
48                         AssertEquals ('Z', w.NewLine [0]);
49
50                         w.UpdateLine2 ();
51                         AssertEquals ('Y', w.NewLine [0]);
52                 }
53         }
54 }