public void MyTestMethod()
        {
            Battery battery = new Battery("BL-5C", 200, 1700, BatteryType.LiIon);
            GSM phone = new GSM("Nokia", "1100", 100f, "Dimitar", battery, 1.5f);
            float callPrice = 2f;
            float expected = 0f;
            CallsGenerator calls=new CallsGenerator();
            for (int i = 0; i < calls.Calls.Length ; i++)
            {
                phone.AddCall(calls.Calls[i]);
                expected += calls.Calls[i].CallDuration / 60f;
            }

            expected *= callPrice;
            float result = phone.CalcCallsPrice(callPrice);
            Assert.AreEqual(expected, result, "All calls price should be correct "+expected);
        }
        public void MyTestMethod()
        {
            Battery        battery   = new Battery("BL-5C", 200, 1700, BatteryType.LiIon);
            GSM            phone     = new GSM("Nokia", "1100", 100f, "Dimitar", battery, 1.5f);
            float          callPrice = 2f;
            float          expected  = 0f;
            CallsGenerator calls     = new CallsGenerator();

            for (int i = 0; i < calls.Calls.Length; i++)
            {
                phone.AddCall(calls.Calls[i]);
                expected += calls.Calls[i].CallDuration / 60f;
            }

            expected *= callPrice;
            float result = phone.CalcCallsPrice(callPrice);

            Assert.AreEqual(expected, result, "All calls price should be correct " + expected);
        }
示例#3
0
        private void CallsForm_Load(object sender, EventArgs e)
        {
            var phoneNumbers = new List <string>()
            {
                "063-0000101", "063-0000102", "063-0000102", "063-0000101",
                "063-0000103", "063-0000102", "063-0000101", "063-0000104", "063-0000104", "063-0000104"
            };

            _callStorage    = new CallsStorage();
            _contactService = new ContactService();
            _contactService.AddContact(new Contact("Contact 1", new List <string>()
            {
                "063-0000101", "063-0000104"
            }));
            _contactService.AddContact(new Contact("Contact 2", "063-0000102"));
            _contactService.AddContact(new Contact("Contact 3", "063-0000103"));
            var outgoings = new List <bool>()
            {
                true, true, false, true, false, true, false, false, true, true
            };

            _callsGenerator = new CallsGenerator(phoneNumbers, outgoings);
            _callsGenerator.CallGenerated += CallGeneratedHandler;
        }
 public BillingSystemServices()
 {
     CallsGen = new CallsGenerator();
     SMSsGen  = new SMSGenerator();
 }