Пример #1
0
 public void SingleSaveNewLine()
 {
     using (MemoryStream ms = new MemoryStream())
     {
         using (ParadoxSaver saver = new ParadoxSaver(ms))
         {
             saver.Write("culture", "michigan");
         }
         Assert.AreEqual("culture=michigan", Globals.ParadoxEncoding.GetString(ms.ToArray()));
     }
 }
Пример #2
0
 public void SaveNonUtf8Characters()
 {
     string actual;
     using (MemoryStream ms = new MemoryStream())
     {
         using (ParadoxSaver saver = new ParadoxSaver(ms))
         {
             saver.Write("name", "šžŸ", ValueWrite.None);
         }
         actual = Globals.ParadoxEncoding.GetString(ms.ToArray());
         Assert.AreEqual("name=šžŸ", actual);
     }
 }
Пример #3
0
 public void SaveDouble()
 {
     string actual;
     using (MemoryStream ms = new MemoryStream())
     {
         using (ParadoxSaver saver = new ParadoxSaver(ms))
         {
             saver.Write(0.23456);
         }
         actual = Globals.ParadoxEncoding.GetString(ms.ToArray());
         Assert.AreEqual("0.235", actual);
     }
 }
Пример #4
0
 public void SaveInt()
 {
     string actual;
     int val = -1235346;
     using (MemoryStream ms = new MemoryStream())
     {
         using (ParadoxSaver saver = new ParadoxSaver(ms))
         {
             saver.Write(val);
         }
         actual = Globals.ParadoxEncoding.GetString(ms.ToArray());
         Assert.AreEqual("-1235346", actual);
     }
 }
Пример #5
0
 public void SaveDatetime()
 {
     string actual;
     DateTime value = new DateTime(1402, 1, 1);
     using (MemoryStream ms = new MemoryStream())
     {
         using (ParadoxSaver saver = new ParadoxSaver(ms))
         {
             saver.Write(value);
         }
         actual = Globals.ParadoxEncoding.GetString(ms.ToArray());
         Assert.AreEqual("1402.1.1", actual);
     }
 }
Пример #6
0
 public void SaveWithoutHeader()
 {
     using (MemoryStream ms = new MemoryStream())
     {
         using (ParadoxSaver saver = new ParadoxSaver(ms))
         {
             saver.Write(String.Empty, (w) =>
                 {
                     w.WriteLine("Hey there!", ValueWrite.LeadingTabs);
                 });
         }
         string actual = Globals.ParadoxEncoding.GetString(ms.ToArray());
         Assert.AreEqual("{\r\n\tHey there!\r\n}\r\n", actual);
     }
 }