Exemplo n.º 1
0
 public void ParseNews()
 {
     TimeSpan t = new TimeSpan(0, 14, 07, 05, 249);
     NOt mynot = NOt.Market;
     string data = "n;s1;i288;NWi1;t140705.249;NOt2;NMsBORSA_BASKANLIGI_DUYURUSU;NHlTest;TExCok yogun Islem yapildigi goruldu. Sozkonusu siralar gecici durdurmaya alindi.;BLi1;BLlY;";
     News n = new News(data);
     Assert.AreEqual(1, n.s);
     Assert.AreEqual(288, n.i);
     Assert.AreEqual(1, n.NWi);
     Assert.AreEqual(t, n.t);
     Assert.AreEqual(mynot, n.NOt);
     Assert.AreEqual("BORSA_BASKANLIGI_DUYURUSU", n.NMs);
     Assert.AreEqual("Test", n.NHl);
     Assert.AreEqual("C*k yogun Islem yapildigi goruldu. Sozkonusu siralar gecici durdurmaya alindi.", n.TEx);
     Assert.AreEqual(1, n.BLi);
     Assert.AreEqual(true, n.BLl);
 }
Exemplo n.º 2
0
 public News(string data)
 {
     string[] words = data.Split(';');
     for (int m = 1; m < words.Length; m++)
     {
         if (words[m].StartsWith(checks[0]))
         {
             s = Int32.Parse(words[m].Substring(1, words[m].Length - 1));
         }
         else if (words[m].StartsWith(checks[1]))
         {
             i = Int32.Parse(words[m].Substring(1, words[m].Length - 1));
         }
         else if (words[m].StartsWith(checks[2]))
         {
             NWi = Int32.Parse(words[m].Substring(3, words[m].Length - 3));
         }
         else if (words[m].StartsWith(checks[3]))
         {
             t = TimeSpan.ParseExact(words[m].Substring(1, words[m].Length - 1), "hhmmss\\.fff", CultureInfo.InvariantCulture);
         }
         else if (words[m].StartsWith(checks[4]))
         {
             if (words[m].Substring(3, words[m].Length - 3) == "1")
             {
                 NOt = NOt.Exchange;
             }
             else if (words[m].Substring(3, words[m].Length - 3) == "2")
             {
                 NOt = NOt.Market;
             }
             else if (words[m].Substring(3, words[m].Length - 3) == "3")
             {
                 NOt = NOt.Orderbook;
             }
             else if (words[m].Substring(3, words[m].Length - 3) == "4")
             {
                 NOt = NOt.Instrument;
             }
             else if (words[m].Substring(3, words[m].Length - 3) == "5")
             {
                 NOt = NOt.Issuer;
             }
             else if (words[m].Substring(3, words[m].Length - 3) == "6")
             {
                 NOt = NOt.Source;
             }
             else
             {
                 NOt = NOt.None;
             }
         }
         else if (words[m].StartsWith(checks[5]))
         {
             NMs = (words[m].Substring(3, words[m].Length - 3));
         }
         else if (words[m].StartsWith(checks[6]))
         {
             URl = (words[m].Substring(3, words[m].Length - 3));
         }
         else if (words[m].StartsWith(checks[7]))
         {
             NHl = (words[m].Substring(3, words[m].Length - 3));
         }
         else if (words[m].StartsWith(checks[8]))
         {
             TEx = (words[m].Substring(3, words[m].Length - 3));
         }
         else if (words[m].StartsWith(checks[9]))
         {
             BLi = Int32.Parse(words[m].Substring(3, words[m].Length - 3));
         }
         else if (words[m].StartsWith(checks[10]))
         {
             if (words[m].Substring(3, words[m].Length - 3) == "N")
             {
                 BLl = false;
             }
             else
             {
                 BLl = true;
             }
         }
     }
 }