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"); }
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); }
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); }
public void CustomerCreateCorrectStatement() { Customer customer = new Customer("Bug"); Movie movie1 = new Movie("Angry Birds", Movie.Type.CHILDREN); Rental rental1 = new Rental(movie1, 2); customer.AddRental(rental1); Movie movie2 = new Movie("StarWar", Movie.Type.NEW_RELEASE); Rental rental2 = new Rental(movie2, 10); customer.AddRental(rental2); Movie movie3 = new Movie("Hatico", Movie.Type.REGULAR); Rental rental3 = new Rental(movie3, 4); customer.AddRental(rental3); string actual = customer.GetReport(); Assert.AreEqual("учет аренды для Bug\n\tAngry Birds\t15\n\tStarWar\t30\n\tHatico\t32\nСумма задолженности составляет 77\nВы заработали 3 очков за активность", actual); }
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); }
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); }