コード例 #1
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);
        }
コード例 #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
 public void Execute()
 {
     var customer = new Customer(_customerName);
     _customerStore.Add(customer);
 }
コード例 #5
0
 public void Add(Customer customer)
 {
     _list.Add(customer);
 }