public void ShouldPopulatestatementModel()
 {
     var statement = new Statement(customer);
     repository.Add(statement);
     ViewResult result = controller.Show(0);
     Assert.That(result.Model, Is.SameAs(statement));
 }
Beispiel #2
0
 public void AnEmptyRentalRecordShouldHaveATotalAmountOfZero()
 {
     var customer = new Customer("John Smith");
     var order = new Order();
     var statement = new Statement(order, customer);
     Assert.AreEqual(statement.TotalAmount(order.Rentals), 0.00);
 }
Beispiel #3
0
 public void GetTotalShouldReturnTheValueOfAllRentals()
 {
     var order = new Order();
     order.Add(new Rental(new Movie("Jaws"), 7));
     order.Add(new Rental(new Movie("Snakes"), 2));
     var statement = new Statement(order, new Customer());
     Assert.AreEqual(9, statement.GetTotalValue());
 }
Beispiel #4
0
        public RedirectResult Create()
        {
            var statement = new Statement(customer.Cart.order, customer);

            int id = repository.Add(statement);
            customer.Cart.EmptyCart();

            return Redirect("/statements/" + id);
        }
        public void ShouldShowStatementHistory()
        {
            var s1 = new Statement(customer);
            var s2 = new Statement(customer);

            repository.Add(s1);
            repository.Add(s2);

            ViewResult result = controller.Index();
            Assert.That(result.Model, Contains.Item(s1));
            Assert.That(result.Model, Contains.Item(s2));
        }
        public void ShouldProvideStatementsForCustomer()
        {
            var repository = new StatementRepository();

            var c1 = new Customer("One");
            var c2 = new Customer("Two");

            var statement = new Statement(c1);
            repository.Add(statement);

            repository.Add(new Statement(c2));

            var c1statements = repository.FindByCustomer(c1);

            Assert.That(c1statements.Contains(statement));
            Assert.That(c1statements.Count(), Is.EqualTo(1));
        }
 public int Add(Statement statement)
 {
     statements.Add(statement);
     return statements.Count - 1;
 }