示例#1
0
        public void WriteLineBoolTest()
        {
            using (CharArrayTextWriter tw = NewTextWriter)
            {
                tw.WriteLine(true);
                Assert.Equal("True" + tw.NewLine, tw.Text);

                tw.Clear();
                tw.WriteLine(false);
                Assert.Equal("False" + tw.NewLine, tw.Text);
            }
        }
示例#2
0
        public void WriteLineDecimalTest()
        {
            using (CharArrayTextWriter tw = NewTextWriter)
            {
                tw.WriteLine(decimal.MinValue);
                Assert.Equal(decimal.MinValue.ToString() + tw.NewLine, tw.Text);

                tw.Clear();
                tw.WriteLine(decimal.MaxValue);
                Assert.Equal(decimal.MaxValue.ToString() + tw.NewLine, tw.Text);
            }
        }
示例#3
0
        public void WriteLineFloatTest()
        {
            using (CharArrayTextWriter tw = NewTextWriter)
            {
                tw.WriteLine(float.MinValue);
                Assert.Equal(float.MinValue.ToString() + tw.NewLine, tw.Text);

                tw.Clear();
                tw.WriteLine(float.MaxValue);
                Assert.Equal(float.MaxValue.ToString() + tw.NewLine, tw.Text);

                tw.Clear();
                tw.WriteLine(float.NaN);
                Assert.Equal(float.NaN.ToString() + tw.NewLine, tw.Text);
            }
        }
示例#4
0
 public void WriteLineStringMultipleObjectsTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.WriteLine(TestDataProvider.FormatStringMultipleObjects, TestDataProvider.MultipleObjects);
         Assert.Equal(string.Format(TestDataProvider.FormatStringMultipleObjects + tw.NewLine, TestDataProvider.MultipleObjects), tw.Text);
     }
 }
示例#5
0
 public void WriteLineStringThreeObjectsTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.WriteLine(TestDataProvider.FormatStringThreeObjects, TestDataProvider.FirstObject, TestDataProvider.SecondObject, TestDataProvider.ThirdObject);
         Assert.Equal(string.Format(TestDataProvider.FormatStringThreeObjects + tw.NewLine, TestDataProvider.FirstObject, TestDataProvider.SecondObject, TestDataProvider.ThirdObject), tw.Text);
     }
 }
示例#6
0
 public void WriteLineStringObjectTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.WriteLine(TestDataProvider.FormatStringOneObject, TestDataProvider.FirstObject);
         Assert.Equal(string.Format(TestDataProvider.FormatStringOneObject + tw.NewLine, TestDataProvider.FirstObject), tw.Text);
     }
 }
示例#7
0
 public void WriteLineObjectTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.WriteLine(TestDataProvider.FirstObject);
         Assert.Equal(TestDataProvider.FirstObject.ToString() + tw.NewLine, tw.Text);
     }
 }
示例#8
0
 public void WriteLineStringTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.WriteLine(new string(TestDataProvider.CharData));
         Assert.Equal(new string(TestDataProvider.CharData) + tw.NewLine, tw.Text);
     }
 }
示例#9
0
 public void WriteLineCharArrayIndexCountTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.WriteLine(TestDataProvider.CharData, 3, 5);
         Assert.Equal(new string(TestDataProvider.CharData, 3, 5) + tw.NewLine, tw.Text);
     }
 }
示例#10
0
 public void WriteLineTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.WriteLine();
         Assert.Equal(tw.NewLine, tw.Text);
     }
 }
示例#11
0
 public void WriteLineCharSpanTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         var rs = new ReadOnlySpan <char>(TestDataProvider.CharData, 4, 6);
         tw.WriteLine(rs);
         Assert.Equal(new string(rs) + tw.NewLine, tw.Text);
     }
 }
示例#12
0
 public void WriteLineCharTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         for (int count = 0; count < TestDataProvider.CharData.Length; ++count)
         {
             tw.WriteLine(TestDataProvider.CharData[count]);
         }
         Assert.Equal(string.Join(tw.NewLine, TestDataProvider.CharData.Select(ch => ch.ToString()).ToArray()) + tw.NewLine, tw.Text);
     }
 }