Ejemplo n.º 1
0
        public void Test()
        {
            GSM g = new GSM(Models.LG, ManufacturerType.Default);

            g.Add(new Call()
            {
                DialedPhoneNumber = "934732592", DTime = new DateTime(2013, 01, 01), DurationInSeconds = 600
            });
            g.Add(new Call()
            {
                DialedPhoneNumber = "93473259234", DTime = new DateTime(2013, 01, 02), DurationInSeconds = 50
            });
            g.Add(new Call()
            {
                DialedPhoneNumber = "4543645592", DTime = new DateTime(2013, 01, 03), DurationInSeconds = 7543
            });
            Call gs = g.CallHistory[0];

            gs.DialedPhoneNumber = "111111111111";
            g.Add(gs);

            Console.WriteLine(g.TotalPrice(0.37));
            Call call = g.CallHistory.OrderBy(c => c.DurationInSeconds).FirstOrDefault();

            if (call != null)
            {
                g.Remove(call);
                Console.WriteLine(g.TotalPrice(0.37));
            }
            g.Clear();
            Console.WriteLine("Finally clear the call history and print it." + Environment.NewLine + "Kakvo trqbva da printna? Nali sam q izchistil.");
        }
Ejemplo n.º 2
0
        public static GSM[] GenerateGSMs(int number)
        {
            GSM[] gsms = new GSM[number];

            for (int i = 0; i < number; i++)
            {
                int col = rnd.Next(0, manufacturersAndModels.GetLength(1));
                int row = rnd.Next(1, manufacturersAndModels.GetLength(0));

                gsms[i] = new GSM(manufacturersAndModels[0, col], manufacturersAndModels[row, col], rnd.Next(1, 2001),
                                  owners[rnd.Next(0, owners.Length)], batteries[rnd.Next(0, batteries.Length)],
                                  displays[rnd.Next(0, displays.Length)], new List <Call>());
            }

            return(gsms);
        }
        public void Test()
        {
            GSM g = new GSM(Models.LG, ManufacturerType.Default);
            g.Add(new Call() { DialedPhoneNumber = "934732592", DTime = new DateTime(2013, 01, 01), DurationInSeconds = 600 });
            g.Add(new Call() { DialedPhoneNumber = "93473259234", DTime = new DateTime(2013, 01, 02), DurationInSeconds = 50 });
            g.Add(new Call() { DialedPhoneNumber = "4543645592", DTime = new DateTime(2013, 01, 03), DurationInSeconds = 7543 });
            Call gs = g.CallHistory[0];
            gs.DialedPhoneNumber = "111111111111";
            g.Add(gs);

            Console.WriteLine(g.TotalPrice(0.37));
            Call call = g.CallHistory.OrderBy(c => c.DurationInSeconds).FirstOrDefault();
            if (call != null)
            {
                g.Remove(call);
                Console.WriteLine(g.TotalPrice(0.37));
            }
            g.Clear();
            Console.WriteLine("Finally clear the call history and print it." + Environment.NewLine + "Kakvo trqbva da printna? Nali sam q izchistil.");
        }
Ejemplo n.º 4
0
 static GSM() //problem 6
 {
     IPhone4S = new GSM("IPhone", "4S", 1999.99, "New Owner", new Battery("Bad", 5, 50, BatteryTypes.LiIon), new Display(), new List <Call>());
 }