TextWriterTest.cs 916 B

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