Exemple #1
0
        //====================================================
        // Reports the area of the currently selected garden
        //====================================================
        public string AreaReporter(Garden currentGarden)
        {
            string reportString = "";

            reportString = String.Format("{0,-14}:{1,8:f2}", currentGarden.OwnerName, currentGarden.GetArea());

            return reportString;
        }
Exemple #2
0
        //====================================================
        // Reports the charges of the currently selected garden
        //====================================================
        public string ChargesReporter(Garden currentGarden)
        {
            string reportString = "";

            reportString = String.Format("{0,-14}:  {1,8:c2}", currentGarden.OwnerName, currentGarden.GetAccountBalance()); // Need the spaces after the colon to pass the test

            return reportString;
        }
Exemple #3
0
        //====================================================
        // Reports the charges of the currently selected garden
        //====================================================
        public string ChargesReporter(Garden currentGarden)
        {
            string reportString = "";

            reportString = String.Format("{0,-14}:  {1,8:c2}", currentGarden.OwnerName, currentGarden.GetAccountBalance()); // Need the spaces after the colon to pass the test

            return(reportString);
        }
Exemple #4
0
        //====================================================
        // Reports the area of the currently selected garden
        //====================================================
        public string AreaReporter(Garden currentGarden)
        {
            string reportString = "";

            reportString = String.Format("{0,-14}:{1,8:f2}", currentGarden.OwnerName, currentGarden.GetArea());

            return(reportString);
        }
Exemple #5
0
 public void AreaReporterTest()
 {
     GardenManager target = new GardenManager();
     Garden currentGarden = new Garden(10, 20, "Bob");
     string expected = "Bob           :  200.00";
     string actual;
     actual = target.AreaReporter(currentGarden);
     Assert.AreEqual(expected, actual);
 }
Exemple #6
0
 public void ChargesReporterTest()
 {
     GardenManager target = new GardenManager(); // TODO: Initialize to an appropriate value
     Garden currentGarden = new Garden(10, 20, "Bob");
     currentGarden.AddCharge(123.45);
     currentGarden.AddCharge(678.90);
     string expected = "Bob           :   $802.35";
     string actual;
     actual = target.ChargesReporter(currentGarden);
     Assert.AreEqual(expected, actual);
 }
Exemple #7
0
        public void GetAccountBalanceTest()
        {
            double gardenWidth = 0F;
            double gardenHeight = 0F;
            string ownerName = "Bob";
            Garden target = new Garden(gardenWidth, gardenHeight, ownerName);

            target.AddCharge(15);
            target.AddCharge(5.5);
            target.AddCharge(10.25);

            double expected = 30.75;
            double actual;
            actual = target.GetAccountBalance();
            Assert.AreEqual(expected, actual);
        }
Exemple #8
0
        //====================================================
        // Dummy data
        //====================================================
        private void populateDummyData()
        {
            Garden garden1 = new Garden(10, 20, "Savitch");
            garden1.AddCharge(123.45);
            garden1.AddCharge(678.90);

            Garden garden2 = new Garden(8.5, 120, "Knuth");
            garden2.AddCharge(45.32);
            garden2.AddCharge(678.90);
            garden2.AddCharge(98.76);

            Garden garden3 = new Garden(54.25, 60, "Winograd");
            garden3.AddCharge(149.32);
            garden3.AddCharge(78.12);
            garden3.AddCharge(150.00);

            mainManager.AddGarden(garden1);
            mainManager.AddGarden(garden2);
            mainManager.AddGarden(garden3);
        }
Exemple #9
0
        //====================================================
        // Dummy data
        //====================================================
        private void populateDummyData()
        {
            Garden garden1 = new Garden(10, 20, "Savitch");

            garden1.AddCharge(123.45);
            garden1.AddCharge(678.90);

            Garden garden2 = new Garden(8.5, 120, "Knuth");

            garden2.AddCharge(45.32);
            garden2.AddCharge(678.90);
            garden2.AddCharge(98.76);

            Garden garden3 = new Garden(54.25, 60, "Winograd");

            garden3.AddCharge(149.32);
            garden3.AddCharge(78.12);
            garden3.AddCharge(150.00);

            mainManager.AddGarden(garden1);
            mainManager.AddGarden(garden2);
            mainManager.AddGarden(garden3);
        }
Exemple #10
0
 //====================================================
 // Add new garden to the manager list
 //====================================================
 public void AddGarden(Garden newGarden)
 {
     gardenList.Add(newGarden);
 }
Exemple #11
0
 //====================================================
 // Add new garden to the manager list
 //====================================================
 public void AddGarden(Garden newGarden)
 {
     gardenList.Add(newGarden);
 }