Example #1
0
        public void Apply_Correct_Vat(string country, double expectedVat)
        {
            //Arrange
            var sut   = new VatApplicator();
            var order = new Order();

            //Act
            sut.ApplyVat(order, new Customer()
            {
                Country = country
            });
            //Assert
            Assert.Equal(expectedVat, order.VAT);
        }
Example #2
0
        static void Main(string[] args)
        {
            //All the decisions behind refactoring this project are explained in commit messages.
            var connectionStringBuilderProvider = new ConfigFileConnectionStringBuilderProvider("MyConnectionString");
            var customerRepository = new CustomerRepositoryImplementation(connectionStringBuilderProvider);
            var orderValidator     = new OrderValidator();
            var vatApplicator      = new VatApplicator();

            var orderServiceFactory = new OrderServiceFactory(customerRepository,
                                                              connectionStringBuilderProvider, orderValidator, vatApplicator);

            var orderService = orderServiceFactory.Create();

            //Load all customers and their linked orders
            var customers = customerRepository.Load(3);

            //Place an order, linked to a customer
            var success = orderService.PlaceOrder(new Order()
            {
                OrderId = 1,
                Amount  = 1,
            }, 1);
        }