Ejemplo n.º 1
0
        public void Should_return_false_when_using_bad_order_values()
        {
            // Arrange
              var order = new Order();
              order.FirstName = "Joe";
              order.LastName = "Wilson";
              order.Email = "*****@*****.**";
              order.Total = 0.00m; // Bad amount

              // Act
              var result = order.ProcessOrder();

              // Assert
              Assert.That(result, Is.False);
        }
Ejemplo n.º 2
0
        public void Should_return_true_when_using_good_order_values()
        {
            // Arrange
              var order = new Order();
              order.FirstName = "Joe";
              order.LastName = "Wilson";
              order.Email = "*****@*****.**";
              order.Total = 123.00m; // Good amount

              // Act
              // TODO: Watch out!  Don't run this or it will send real emails!
              var result = order.ProcessOrder();

              // Assert
              Assert.That(result, Is.True);
        }
Ejemplo n.º 3
0
        public void Should_return_true_when_using_good_order_values()
        {
            // Arrange
              var emailService = new FakeEmailService();
              var order = new Order(emailService);
              order.FirstName = "Joe";
              order.LastName = "Wilson";
              order.Email = "*****@*****.**";
              order.Total = 123.00m; // Good amount

              // Act
              var result = order.ProcessOrder();

              // Assert
              Assert.That(result, Is.True);
        }
Ejemplo n.º 4
0
        public bool SendOrderConfirmationEmail(Order order)
        {
            var result = false;

              try
              {
            var from = "*****@*****.**";
            var to = order.Email;
            var subject = "Order Confirmation";
            var body = string.Format("Thanks for your order of {0}.", order.Total);
            var message = new MailMessage(from, to, subject, body);

            var smtp = new SmtpClient();
            smtp.Send(message);

            result = true;
              }
              catch (SmtpException smtpException)
              {
            result = false;
              }

              return result;
        }
 public bool SendOrderConfirmationEmail(Order order)
 {
     return true;
 }
Ejemplo n.º 6
0
 public void Save(Order order)
 {
     // Pretend DB save
 }