Write() public méthode

public Write ( char value ) : void
value char
Résultat void
Exemple #1
0
        public void WriteBoolTest()
        {
            using (CharArrayTextWriter tw = NewTextWriter)
            {
                tw.Write(true);
                Assert.Equal("True", tw.Text);

                tw.Clear();
                tw.Write(false);
                Assert.Equal("False", tw.Text);
            }
        }
Exemple #2
0
        public void WriteLongTest()
        {
            using (CharArrayTextWriter tw = NewTextWriter)
            {
                tw.Write(long.MinValue);
                Assert.Equal(long.MinValue.ToString(), tw.Text);

                tw.Clear();
                tw.Write(long.MaxValue);
                Assert.Equal(long.MaxValue.ToString(), tw.Text);
            }
        }
Exemple #3
0
        public void WriteFloatTest()
        {
            using (CharArrayTextWriter tw = NewTextWriter)
            {
                tw.Write(float.MinValue);
                Assert.Equal(float.MinValue.ToString(), tw.Text);

                tw.Clear();
                tw.Write(float.MaxValue);
                Assert.Equal(float.MaxValue.ToString(), tw.Text);

                tw.Clear();
                tw.Write(float.NaN);
                Assert.Equal(float.NaN.ToString(), tw.Text);
            }
        }
Exemple #4
0
 public void WriteCharArrayIndexCountTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.Write(TestDataProvider.CharData, 3, 5);
         Assert.Equal(new string(TestDataProvider.CharData, 3, 5), tw.Text);
     }
 }
Exemple #5
0
 public void WriteStringMultipleObjectsTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.Write(TestDataProvider.FormatStringMultipleObjects, TestDataProvider.MultipleObjects);
         Assert.Equal(string.Format(TestDataProvider.FormatStringMultipleObjects, TestDataProvider.MultipleObjects), tw.Text);
     }
 }
Exemple #6
0
 public void WriteStringThreeObjectsTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.Write(TestDataProvider.FormatStringThreeObjects, TestDataProvider.FirstObject, TestDataProvider.SecondObject, TestDataProvider.ThirdObject);
         Assert.Equal(string.Format(TestDataProvider.FormatStringThreeObjects, TestDataProvider.FirstObject, TestDataProvider.SecondObject, TestDataProvider.ThirdObject), tw.Text);
     }
 }
Exemple #7
0
 public void WriteStringObjectTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.Write(TestDataProvider.FormatStringOneObject, TestDataProvider.FirstObject);
         Assert.Equal(string.Format(TestDataProvider.FormatStringOneObject, TestDataProvider.FirstObject), tw.Text);
     }
 }
Exemple #8
0
 public void WriteObjectTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.Write(TestDataProvider.FirstObject);
         Assert.Equal(TestDataProvider.FirstObject.ToString(), tw.Text);
     }
 }
Exemple #9
0
 public void WriteStringTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         tw.Write(new string(TestDataProvider.CharData));
         Assert.Equal(new string(TestDataProvider.CharData), tw.Text);
     }
 }
Exemple #10
0
 public void WriteCharSpanTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         var rs = new ReadOnlySpan <char>(TestDataProvider.CharData, 4, 6);
         tw.Write(rs);
         Assert.Equal(new string(rs), tw.Text);
     }
 }
Exemple #11
0
 public void WriteCharTest()
 {
     using (CharArrayTextWriter tw = NewTextWriter)
     {
         for (int count = 0; count < TestDataProvider.CharData.Length; ++count)
         {
             tw.Write(TestDataProvider.CharData[count]);
         }
         Assert.Equal(new string(TestDataProvider.CharData), tw.Text);
     }
 }