Beispiel #1
0
        public void TestInalidPriceCode()
        {
            var name = "Eric";
            var movieTitle = "Test";
            var priceCode = 5;
            var daysRented = 4;
            var c = new Customer(name);
            var m = new Movie(movieTitle, priceCode);
            var r = new Rental(m, daysRented);

            c.AddRental(r);
        }
Beispiel #2
0
        public void TestMultiRental()
        {
            var m = new Movie("Taken", Movie.NewRelease);
            var m2 = new Movie("The Rock", Movie.Regular);
            var m3 = new Movie("300", Movie.NewRelease);
            var m4 = new Movie("Bambi", Movie.Childrens);
            var r = new Rental(m, 4);
            var r2 = new Rental(m2, 5);
            var r3 = new Rental(m3, 2);
            var r4 = new Rental(m4, 7);

            var c = new Customer("Eric");
            c.AddRental(r);
            c.AddRental(r2);
            c.AddRental(r3);
            c.AddRental(r4);
            Assert.AreEqual(c.Statement(), "Rental Record for Eric\n\tTaken\t12\n\tThe Rock\t6.5\n\t300\t6\n\tBambi\t7.5\nAmount owed is 32\nYou earned 6 frequent renter points");
        }
Beispiel #3
0
        public void TestMultiRentalHtml()
        {
            var m = new Movie("Taken", Movie.NewRelease);
            var m2 = new Movie("The Rock", Movie.Regular);
            var m3 = new Movie("300", Movie.NewRelease);
            var m4 = new Movie("Bambi", Movie.Childrens);
            var r = new Rental(m, 4);
            var r2 = new Rental(m2, 5);
            var r3 = new Rental(m3, 2);
            var r4 = new Rental(m4, 7);

            var c = new Customer("Eric");
            c.AddRental(r);
            c.AddRental(r2);
            c.AddRental(r3);
            c.AddRental(r4);
            Assert.AreEqual(c.HtmlStatement(), "<h1>Rentals for <em>Eric</em></h1></p>\nTaken: 12<br />\nThe Rock: 6.5<br />\n300: 6<br />\nBambi: 7.5<br />\n<p>You owe <em>32</em></p>\nOn this rental you earned <em>6</em> frequent renter points</p>");
        }
Beispiel #4
0
 public void TestCreatenewRental()
 {
     var m = new Movie("Test", 2);
     var r = new Rental(m, 4);
     Assert.AreEqual(r.GetMovie(), m);
 }
Beispiel #5
0
 public void TestCreateRental()
 {
     var m = new Movie("Test", 2);
     var r = new Rental(m,4);
     Assert.IsNotNull(r);
 }
Beispiel #6
0
 public void TestTwoRentalHtml()
 {
     var m = new Movie("Taken", Movie.NewRelease);
     var m2 = new Movie("The Rock", Movie.Regular);
     var r = new Rental(m, 4);
     var r2 = new Rental(m2, 5);
     var c = new Customer("Eric");
     c.AddRental(r);
     c.AddRental(r2);
     Assert.AreEqual(c.HtmlStatement(), "<h1>Rentals for <em>Eric</em></h1></p>\nTaken: 12<br />\nThe Rock: 6.5<br />\n<p>You owe <em>18.5</em></p>\nOn this rental you earned <em>3</em> frequent renter points</p>");
 }
Beispiel #7
0
 public void TestTwoRentalXML()
 {
     var m = new Movie("Taken", Movie.NewRelease);
     var m2 = new Movie("The Rock", Movie.Regular);
     var r = new Rental(m, 4);
     var r2 = new Rental(m2, 5);
     var c = new Customer("Eric");
     c.AddRental(r);
     c.AddRental(r2);
     Assert.AreEqual(c.XMLStatement(), "<Statement><Name>Eric</Name><Rentals><Rental><MovieName>Taken</MovieName><CostToRent>12</CostToRent></Rental><Rental><MovieName>The Rock</MovieName><CostToRent>6.5</CostToRent></Rental></Rentals><AmountOwed>18.5</AmountOwed><PointsEarned>3</PointsEarned></Statement>");
 }
Beispiel #8
0
        public void TestRentRegular()
        {
            var name = "Eric";
            var movieTitle = "The Shawshank Redemption";
            var priceCode = Movie.Regular;
            var daysRented = 4;
            var c = new Customer(name);
            var m = new Movie(movieTitle, priceCode);
            var r = new Rental(m, daysRented);

            c.AddRental(r);
            Assert.AreEqual(c.Statement(), "Rental Record for " + name + "\n\t" + movieTitle + "\t5\nAmount owed is 5\nYou earned 1 frequent renter points");
        }
Beispiel #9
0
 public void TestTwoRental()
 {
     var m = new Movie("Taken", Movie.NewRelease);
     var m2 = new Movie("The Rock", Movie.Regular);
     var r = new Rental(m, 4);
     var r2 = new Rental(m2, 5);
     var c = new Customer("Eric");
     c.AddRental(r);
     c.AddRental(r2);
     Assert.AreEqual(c.Statement(), "Rental Record for Eric\n\tTaken\t12\n\tThe Rock\t6.5\nAmount owed is 18.5\nYou earned 3 frequent renter points");
 }
Beispiel #10
0
        public void TestRentNewRelease()
        {
            var name = "Eric";
            var movieTitle = "Law Abiding Citizen";
            var priceCode = Movie.NewRelease;
            var daysRented = 4;
            var c = new Customer(name);
            var m = new Movie(movieTitle, priceCode);
            var r = new Rental(m, daysRented);

            c.AddRental(r);
            Assert.AreEqual(c.Statement(), "Rental Record for " + name + "\n\t" + movieTitle + "\t12\nAmount owed is 12\nYou earned 2 frequent renter points");
        }
Beispiel #11
0
        public void TestRentChildrens()
        {
            var name = "Eric";
            var movieTitle = "UP";
            var priceCode = Movie.Childrens;
            var daysRented = 4;
            var c = new Customer(name);
            var m = new Movie(movieTitle, priceCode);
            var r = new Rental(m, daysRented);

            c.AddRental(r);
            Assert.AreEqual(c.Statement(), "Rental Record for " + name + "\n\t" + movieTitle + "\t3\nAmount owed is 3\nYou earned 1 frequent renter points");
        }
Beispiel #12
0
        public void TestMultiRentalXML()
        {
            var m = new Movie("Taken", Movie.NewRelease);
            var m2 = new Movie("The Rock", Movie.Regular);
            var m3 = new Movie("300", Movie.NewRelease);
            var m4 = new Movie("Bambi", Movie.Childrens);
            var r = new Rental(m, 4);
            var r2 = new Rental(m2, 5);
            var r3 = new Rental(m3, 2);
            var r4 = new Rental(m4, 7);

            var c = new Customer("Eric");
            c.AddRental(r);
            c.AddRental(r2);
            c.AddRental(r3);
            c.AddRental(r4);
            Assert.AreEqual(c.XMLStatement(), "<Statement><Name>Eric</Name><Rentals><Rental><MovieName>Taken</MovieName><CostToRent>12</CostToRent></Rental><Rental><MovieName>The Rock</MovieName><CostToRent>6.5</CostToRent></Rental><Rental><MovieName>300</MovieName><CostToRent>6</CostToRent></Rental><Rental><MovieName>Bambi</MovieName><CostToRent>7.5</CostToRent></Rental></Rentals><AmountOwed>32</AmountOwed><PointsEarned>6</PointsEarned></Statement>");
        }
Beispiel #13
0
 public abstract String SingleRentalString(Rental aRental);
Beispiel #14
0
 public void AddRental(Rental arg)
 {
     _rentals.Add(arg);
 }