Пример #1
0
        public void should_cal_amount_for_one_rent(string name, int type, int days, string amount, string points)
        {
            var john = new Customer("John");
            john.AddRental(new Rental(new Movie(name, type), days));
            var match = Patten.Match(john.Statement());
            Console.WriteLine(john.Statement());
            match.Groups["name"].Captures[0].Value.Should().Be("John");

            match.Groups["amount"].Captures[0].Value.Should().Be(amount);
            match.Groups["points"].Captures[0].Value.Should().Be(points);

            match.Groups["title"].Captures[0].Value.Should().Be(name);
            match.Groups["sigleAmount"].Captures[0].Value.Should().Be(amount);
        }
Пример #2
0
        public void should_cal_amount_for_one_rent(string name, int type, int days, string amount, string points)
        {
            var john = new Customer("John");

            john.AddRental(new Rental(new Movie(name, type), days));
            var match = Patten.Match(john.Statement());

            Console.WriteLine(john.Statement());
            match.Groups["name"].Captures[0].Value.Should().Be("John");

            match.Groups["amount"].Captures[0].Value.Should().Be(amount);
            match.Groups["points"].Captures[0].Value.Should().Be(points);

            match.Groups["title"].Captures[0].Value.Should().Be(name);
            match.Groups["sigleAmount"].Captures[0].Value.Should().Be(amount);
        }
Пример #3
0
        public void should_get_statement_after_rent_more_movies()
        {
            var john = new Customer("John");
            john.AddRental(new Rental(new Movie("Iron Man 3", Movie.NEW_RELEASE), 5));
            john.AddRental(new Rental(new Movie("Spider Man", Movie.REGULAR), 5));
            john.AddRental(new Rental(new Movie("Ice Age 4", Movie.CHILDRENS), 3));
            Console.WriteLine(john.Statement());
            var match = Patten.Match(john.Statement());

            match.Groups["name"].Captures[0].Value.Should().Be("John");
            match.Groups["amount"].Captures[0].Value.Should().Be("23");
            match.Groups["points"].Captures[0].Value.Should().Be("4");

            match.Groups["title"].Captures[0].Value.Should().Be("Iron Man 3");
            match.Groups["title"].Captures[1].Value.Should().Be("Spider Man");
            match.Groups["title"].Captures[2].Value.Should().Be("Ice Age 4");
            match.Groups["sigleAmount"].Captures[0].Value.Should().Be("15");
            match.Groups["sigleAmount"].Captures[1].Value.Should().Be("6.5");
            match.Groups["sigleAmount"].Captures[2].Value.Should().Be("1.5");
        }
Пример #4
0
        static void Main(string[] args)
        {
            Movie movie = new Movie("Transformer", Movie.REGULAR);
		
		    Rental rental = new Rental(movie, 3);
		
		    Customer customer = new Customer("jpartogi");
		    customer.AddRental(rental);
		
		    String statement = customer.Statement();
            System.Console.WriteLine(statement);
        }
Пример #5
0
        public void should_get_statement_after_rent_more_movies()
        {
            var john = new Customer("John");

            john.AddRental(new Rental(new Movie("Iron Man 3", Movie.NEW_RELEASE), 5));
            john.AddRental(new Rental(new Movie("Spider Man", Movie.REGULAR), 5));
            john.AddRental(new Rental(new Movie("Ice Age 4", Movie.CHILDRENS), 3));
            Console.WriteLine(john.Statement());
            var match = Patten.Match(john.Statement());

            match.Groups["name"].Captures[0].Value.Should().Be("John");
            match.Groups["amount"].Captures[0].Value.Should().Be("23");
            match.Groups["points"].Captures[0].Value.Should().Be("4");

            match.Groups["title"].Captures[0].Value.Should().Be("Iron Man 3");
            match.Groups["title"].Captures[1].Value.Should().Be("Spider Man");
            match.Groups["title"].Captures[2].Value.Should().Be("Ice Age 4");
            match.Groups["sigleAmount"].Captures[0].Value.Should().Be("15");
            match.Groups["sigleAmount"].Captures[1].Value.Should().Be("6.5");
            match.Groups["sigleAmount"].Captures[2].Value.Should().Be("1.5");
        }
Пример #6
0
        public void TestStatement()
        {
            Movie movie = new RegularMovie("Transformer");

            Rental rental = new Rental(movie, 3);

            Customer customer = new Customer("jpartogi");

            customer.AddRental(rental);

            String statement = customer.Statement();

            StringAssert.Contains(statement, "Transformer");
        }
Пример #7
0
        static void Main(string[] args)
        {
            Movie movie = new Movie("Transformer", Movie.REGULAR);

            Rental rental = new Rental(movie, 3);

            Customer customer = new Customer("jpartogi");

            customer.AddRental(rental);

            String statement = customer.Statement();

            System.Console.WriteLine(statement);
        }
Пример #8
0
        static void Main(string[] args)
        {
            Movie movie = new Movie("Transformer", Movie.REGULAR);

            Rental rental = new Rental(movie, 3);

            Customer customer = new Customer("Sao");

            customer.AddRental(new Rental(new Movie("NARNIA", Movie.NEW_RELEASE), 5));

            customer.AddRental(rental);

            String statement = customer.Statement();

            System.Console.WriteLine(statement);
            Console.ReadLine();
        }
Пример #9
0
        public void Should_Return_Statement_For_REGULAR_Film_Rentel()
        {
            var movie = new RegularMovie("PirateDesCaraibe");

            var rental = new Rental(movie, 3);

            var customer = new Customer("Maher");

            customer.AddRental(rental);

            //var expected = "Rental Record for Maher\n" +
            //               "\tPirateDesCaraibe\t9\n"+
            //               "Amount owed is 9\n" +
            //               "You earned 2 frequent renter points";

            var expected = "Rental Record for Maher\n\tPirateDesCaraibe\t3,5\nAmount owed is 3,5\nYou earned 1 frequent renter points";

            var actualStaement = customer.Statement();

            Assert.AreEqual(expected, actualStaement);
        }
        public void CustomerCreateCorrectStatement()
        {
            Customer customer = new Customer("Bug");
            var      movie1   = new ChildrenMovie("Angry Birds", Rental.ChildrenBaseAmount);
            Rental   rental1  = new Rental(movie1, 2);

            customer.AddRental(rental1);

            var    movie2  = new NewReleaseMovie("StarWar", Rental.NewReleaseBaseAmount);
            Rental rental2 = new Rental(movie2, 10);

            customer.AddRental(rental2);

            var    movie3  = new RegularMovie("Hatico", Rental.RegularBaseAmount);
            Rental rental3 = new Rental(movie3, 4);

            customer.AddRental(rental3);

            string actual = customer.Statement();

            Assert.AreEqual("учет аренды для Bug\n\tAngry Birds\t15\n\tStarWar\t30\n\tHatico\t32\nСумма задолженности составляет 77\nВы заработали 4 очков за активность", actual);
        }