Clean every thing up in VS2010
authorMichael Welch <michaelgwelch@gmail.com>
Fri, 24 Feb 2012 14:47:01 +0000 (08:47 -0600)
committerMichael Welch <michaelgwelch@gmail.com>
Fri, 24 Feb 2012 14:47:01 +0000 (08:47 -0600)
.gitignore
RefactoringChapter1/Customer.cs
RefactoringChapter1/Movie.cs
RefactoringChapter1/Rental.cs

index 898c86c..c1ebb23 100644 (file)
@@ -1,3 +1,6 @@
 bin/
+obj/
+*.suo
 *.pidb
 *.userprefs
+_Resharper.*/
index d468146..06b5bc8 100644 (file)
@@ -1,81 +1,80 @@
-using System;
 using System.Linq;
 using System.Collections.Generic;
 
 namespace RefactoringChapter1
 {
-       public class Customer
-       {
-               private string _name;
-               private List<Rental> _rentals = new List<Rental> ();
-               
-               public Customer (string name)
-               {
-                       _name = name;
-               }
-               
-               public void AddRental (Rental rental)
-               {
-                       _rentals.Add (rental);
-               }
-               
-               public string Name
-               {
-                       get { return _name; }
-               }
-               
-               public string Statement ()
-               {
-                       string result = "Rental Record for " + Name + "\n";
-                       
-                       // determine ammounts for each line
-                       result += _rentals.Aggregate("", (lines, rental) => lines + 
-                                                     "\t" + rental.Movie.Title +
-                                                     "\t" + rental.Charge + "\n");
-                       
-                       // add footer lines
-                       result += "Amount owed is " + TotalCharge + "\n";
-                       result += "You earned " + TotalFrequentRenterPoints + " frequent renter points";
-                       return result;
-                       
-
-                       
-               }
-               
-               public string HtmlStatement ()
-               {
-                       string result = "<H1>Rentals for <EM>" + Name + "</EM></H1><P>\n";
-                       
-                       // add all lines
-                       result += _rentals.Aggregate("", (lines, rental) =>
-                                                   lines + rental.Movie.Title + ": " +
-                                                   rental.Charge + "<BR>\n");
-                       
-                       // add footer lines
-                       result += "<P>You owe <EM>" + TotalCharge + "</EM><P>\n";
-                       result += "On this rental you earned <EM>" + TotalFrequentRenterPoints +
-                               "</EM> frequent renter points<P>";
-                       return result;
-               }
-               
-               private double TotalCharge
-               {
-                       get
-                       {
-                               
-                               return _rentals.Sum(rental => rental.Charge);
-
-                       }
-               }
-               
-               private int TotalFrequentRenterPoints
-               {
-                       get
-                       {
-                               return _rentals.Sum(rental => rental.FrequentRenterPoints);
-                       }
-               }
-
-       }
+    public class Customer
+    {
+        private string _name;
+        private List<Rental> _rentals = new List<Rental>();
+
+        public Customer(string name)
+        {
+            _name = name;
+        }
+
+        public void AddRental(Rental rental)
+        {
+            _rentals.Add(rental);
+        }
+
+        public string Name
+        {
+            get { return _name; }
+        }
+
+        public string Statement()
+        {
+            string result = "Rental Record for " + Name + "\n";
+
+            // determine ammounts for each line
+            result += _rentals.Aggregate("", (lines, rental) => lines +
+                                          "\t" + rental.Movie.Title +
+                                          "\t" + rental.Charge + "\n");
+
+            // add footer lines
+            result += "Amount owed is " + TotalCharge + "\n";
+            result += "You earned " + TotalFrequentRenterPoints + " frequent renter points";
+            return result;
+
+
+
+        }
+
+        public string HtmlStatement()
+        {
+            string result = "<H1>Rentals for <EM>" + Name + "</EM></H1><P>\n";
+
+            // add all lines
+            result += _rentals.Aggregate("", (lines, rental) =>
+                                        lines + rental.Movie.Title + ": " +
+                                        rental.Charge + "<BR>\n");
+
+            // add footer lines
+            result += "<P>You owe <EM>" + TotalCharge + "</EM><P>\n";
+            result += "On this rental you earned <EM>" + TotalFrequentRenterPoints +
+                "</EM> frequent renter points<P>";
+            return result;
+        }
+
+        private double TotalCharge
+        {
+            get
+            {
+
+                return _rentals.Sum(rental => rental.Charge);
+
+            }
+        }
+
+        private int TotalFrequentRenterPoints
+        {
+            get
+            {
+                return _rentals.Sum(rental => rental.FrequentRenterPoints);
+            }
+        }
+
+    }
 }
 
index 350f5a2..b418801 100644 (file)
@@ -1,34 +1,32 @@
-using System;
-
 namespace RefactoringChapter1
 {
-       public class Movie
-       {
-               public const int Childrens = 2;
-               public const int Regular = 0;
-               public const int NewRelease = 1;
-               
-               private string _title;
-               private int _priceCode;
-               
-               public Movie (string title, int priceCode)
-               {
-                       _title = title;
-                       _priceCode = priceCode;
-               }
-               
-               public int PriceCode 
-               { 
-                       get { return _priceCode; } 
-                       set { _priceCode = value; }
-               }
-               
-               public string Title 
-               {
-                       get { return _title; } 
-               }
-               
-               
-       }
+    public class Movie
+    {
+        public const int Childrens = 2;
+        public const int Regular = 0;
+        public const int NewRelease = 1;
+
+        private string _title;
+        private int _priceCode;
+
+        public Movie(string title, int priceCode)
+        {
+            _title = title;
+            _priceCode = priceCode;
+        }
+
+        public int PriceCode
+        {
+            get { return _priceCode; }
+            set { _priceCode = value; }
+        }
+
+        public string Title
+        {
+            get { return _title; }
+        }
+
+
+    }
 }
 
index c51ab18..df2477c 100644 (file)
@@ -1,72 +1,70 @@
-using System;
-
 namespace RefactoringChapter1
 {
-       public class Rental
-       {
-               private Movie _movie;
-               private int _daysRented;
-               
-               public Rental (Movie movie, int daysRented)
-               {
-                       _movie = movie;
-                       _daysRented = daysRented;
-               }
-               
-               public int DaysRented 
-               {
-                       get { return _daysRented; }
-               }
-               
-               public Movie Movie 
-               {
-                       get { return _movie; }
-               }
-               
-               public double Charge 
-               {
-                       get 
-                       {
-                               double result = 0;
-                               switch (Movie.PriceCode)
-                               {
-                               case Movie.Regular:
-                                       result += 2;
-                                       if (DaysRented > 2)
-                                       {
-                                               result += (DaysRented - 2) * 1.5;
-                                       }
-                                       break;
-                                       
-                               case Movie.NewRelease:
-                                       result += DaysRented * 3;
-                                       break;
-                                       
-                               case Movie.Childrens:
-                                       result += 1.5;
-                                       if (DaysRented > 3)
-                                       {
-                                               result += (DaysRented - 3) * 1.5;
-                                       }
-                                       break;
-                                               
-                               }
-                               return result;
-                       }
-               }
-               
-               public int FrequentRenterPoints 
-               {
-                       get
-                       {
-                               
-                               return (Movie.PriceCode == Movie.NewRelease &&
-                                   DaysRented > 1) ? 2 : 1;
+    public class Rental
+    {
+        private Movie _movie;
+        private int _daysRented;
+
+        public Rental(Movie movie, int daysRented)
+        {
+            _movie = movie;
+            _daysRented = daysRented;
+        }
+
+        public int DaysRented
+        {
+            get { return _daysRented; }
+        }
+
+        public Movie Movie
+        {
+            get { return _movie; }
+        }
+
+        public double Charge
+        {
+            get
+            {
+                double result = 0;
+                switch (Movie.PriceCode)
+                {
+                    case Movie.Regular:
+                        result += 2;
+                        if (DaysRented > 2)
+                        {
+                            result += (DaysRented - 2) * 1.5;
+                        }
+                        break;
+
+                    case Movie.NewRelease:
+                        result += DaysRented * 3;
+                        break;
+
+                    case Movie.Childrens:
+                        result += 1.5;
+                        if (DaysRented > 3)
+                        {
+                            result += (DaysRented - 3) * 1.5;
+                        }
+                        break;
+
+                }
+                return result;
+            }
+        }
+
+        public int FrequentRenterPoints
+        {
+            get
+            {
+
+                return (Movie.PriceCode == Movie.NewRelease &&
+                    DaysRented > 1) ? 2 : 1;
+
+            }
+        }
+    }
+
 
-                       }
-               }
-       }
-       
-       
 }