public void TestStdev() { #region arrange List <Financial_Instrument> fi = new List <Financial_Instrument>(); FirmaTranzactionata ft = new FirmaTranzactionata(); ft.Symbol = "SNP"; Financial_Instrument fin = new Financial_Instrument(ft); fin.Price = 5; fi.Add(fin); FirmaTranzactionata ft1 = new FirmaTranzactionata(); ft1.Symbol = "SNP"; Financial_Instrument fin1 = new Financial_Instrument(ft1); fin1.Price = 9; fi.Add(fin1); Financial_Instrument fin2 = new Financial_Instrument(); fin2.Symbol = "RRC"; fin2.Volume = 1000; fi.Add(fin2); #endregion #region act Statistics a = new Statistics(fi); #endregion #region assert Assert.AreEqual((decimal)2.83, Math.Round((decimal)a.StandardDev("SNP"), 2)); // desi valorile sunt egale, daca unul e tip decimal //si unul e double, nu le considera egale. De ce? Cum pot sa fac sa elimin nevoia asta de conversie? #endregion }
public void TestVirtual() { FirmaTranzactionata ft = new FirmaTranzactionata(); Assert.AreEqual(PropertyType.Listed, ft.GetMyProperty()); Assert.AreEqual(2, ft.x()); Firma ft1 = new FirmaTranzactionata(); Assert.AreEqual(PropertyType.Listed, ft1.GetMyProperty()); Assert.AreEqual(1, ft1.x()); }
static void Main(string[] args) { //var x = GetData(); //Console.WriteLine(i); //var nr = x.First(); //Console.WriteLine(i); //var arr = x.ToArray(); //Console.WriteLine(i); //Person p1 = new Person("Andrei"); //Person p2 = new Person("Ciprian"); //Console.WriteLine(Person.Name); //Console.WriteLine(Person.Name); Console.WriteLine("Bine ati venit!"); Console.WriteLine("Pentru introducerea manuala a datelor, selectati 1 \n" + "Pentru citirea datelor dintr-un fisier, selectati 2 \n" + "Pentru citirea datelor dintr-o pagina web, selectati 3 \n"); int selection = Int32.Parse(Console.ReadLine()); List <Financial_Instrument> Assets = null; if (selection == 1) { Assets = IntroducereManuala(); } else if (selection == 2) { Assets = CitireFisier(); } ReadSymbolAndShowStatistics(Assets); Console.WriteLine("End program"); List <Firma> Firme = new List <Firma>(); FirmaTranzactionata Google = new FirmaTranzactionata(); FirmaNetranzactionata Hidroelectrica = new FirmaNetranzactionata(); Firme.Add(Google); Firme.Add(Hidroelectrica); Console.WriteLine(Hidroelectrica.GetMyProperty()); Console.ReadLine(); }