public void AddCustomer_Success_NoCreditLimit()
        {
            TestCustomerRepository    customerRepository    = new TestCustomerRepository();
            TestCompanyRepository     companyRepository     = new TestCompanyRepository();
            TestCustomerCreditService customerCreditService = new TestCustomerCreditService();

            Customer customer = new Customer()
            {
                Firstname    = "John",
                Surname      = "Doe",
                DateOfBirth  = DateTime.Now.AddYears(-22),
                EmailAddress = "*****@*****.**",
            };

            CustomerService customerService = new CustomerService(companyRepository, customerRepository, customerCreditService);

            customerService.AddCustomer(customer.Firstname, customer.Surname, customer.EmailAddress, customer.DateOfBirth, 1);

            var addedCustomer = customerRepository.GetLastAddedCustomer();

            Assert.AreEqual(customer.Firstname, addedCustomer.Firstname);
            Assert.AreEqual(customer.Surname, addedCustomer.Surname);
            Assert.AreEqual(customer.EmailAddress, addedCustomer.EmailAddress);
            Assert.AreEqual(customer.DateOfBirth, addedCustomer.DateOfBirth);
            Assert.IsFalse(addedCustomer.HasCreditLimit);
        }
        public void AddCustomer_fail_CreditTooLow()
        {
            TestCustomerRepository    customerRepository    = new TestCustomerRepository();
            TestCompanyRepository     companyRepository     = new TestCompanyRepository();
            TestCustomerCreditService customerCreditService = new TestCustomerCreditService();

            Customer customer = new Customer()
            {
                Id           = 1,
                Firstname    = "John",
                Surname      = "Poor",
                DateOfBirth  = DateTime.Now.AddYears(-22),
                EmailAddress = "*****@*****.**",
            };

            CustomerService customerService = new CustomerService(companyRepository, customerRepository, customerCreditService);

            Assert.IsFalse(customerService.AddCustomer(customer.Firstname, customer.Surname, customer.EmailAddress, customer.DateOfBirth, 0));
        }
        public void AddCustomer_Fail_TooYoung()
        {
            //I should really change these to use a mocking framework like Moq or Rhino, but tbh these are so simple this is easier and quicker.
            TestCustomerRepository    customerRepository    = new TestCustomerRepository();
            TestCompanyRepository     companyRepository     = new TestCompanyRepository();
            TestCustomerCreditService customerCreditService = new TestCustomerCreditService();

            Customer customer = new Customer()
            {
                Id           = 1,
                Firstname    = "John",
                Surname      = "Doe",
                DateOfBirth  = DateTime.Now.AddYears(-20),
                EmailAddress = "*****@*****.**",
            };

            CustomerService customerService = new CustomerService(companyRepository, customerRepository, customerCreditService);

            Assert.IsFalse(customerService.AddCustomer(customer.Firstname, customer.Surname, customer.EmailAddress, customer.DateOfBirth, 0));
        }