Exemple #1
0
 public OrderService(IOrderDataService orderDataService, ICustomerService _customerService,
                     IOrderFulfillmentService orderFulfillmentService)
 {
     _orderDataService        = orderDataService;
     customerService          = _customerService;
     _orderFulfillmentService = orderFulfillmentService;
 }
        public void BeforeEach()
        {
            _productRepo = Substitute.For<IProductRepository>();
            _orderFulfillmentService = Substitute.For<IOrderFulfillmentService>();
            _customerRepository = Substitute.For<ICustomerRepository>();
            _taxRateService = Substitute.For<ITaxRateService>();
            _emailService = Substitute.For<IEmailService>();

            _subject = new OrderService(_orderFulfillmentService,
                _customerRepository,
                _taxRateService,
                _emailService);

            _bestCustomer = new Customer
            {
                CustomerId = 42,
                PostalCode = "12345",
                Country = "Merica"
            };

            _listOfTaxEntries = new List<TaxEntry>
            {
                new TaxEntry {Description = "High Tax", Rate = (decimal) 0.60},
                new TaxEntry {Description = "Low Tax", Rate = (decimal) 0.10}
            };

            _orderConfirmation = new OrderConfirmation
            {
                OrderId = 1234,
                OrderNumber = "hello"
            };
            _customerRepository.Get(_bestCustomer.CustomerId.Value).Returns(_bestCustomer);
            _taxRateService.GetTaxEntries(_bestCustomer.PostalCode, _bestCustomer.Country).Returns(_listOfTaxEntries);
        }
Exemple #3
0
 public ShipmentCapture(IPurchaseAccountant purchaseAccountant, IShipmentStatusHistoryService shipmentStatusHistoryService, IOrderFulfillmentService orderFulfillmentService, IWarehouseInventoryService warehouseInventoryService)
 {
     _purchaseAccountant           = purchaseAccountant;
     _shipmentStatusHistoryService = shipmentStatusHistoryService;
     _orderFulfillmentService      = orderFulfillmentService;
     _warehouseInventoryService    = warehouseInventoryService;
 }
Exemple #4
0
 public void SetupTestFixture()
 {
     _orderDataService        = new Mock <IOrderDataService>().Object;
     _customerService         = new Mock <ICustomerService>().Object;
     _orderFulfillmentService = new Mock <IOrderFulfillmentService>().Object;
     _orderService            = new OrderService(_orderDataService, _customerService, _orderFulfillmentService);
 }
Exemple #5
0
 public void SetupTestFixture()
 {
     _orderDataService        = Mock.Create <IOrderDataService>();
     _customerService         = Mock.Create <ICustomerService>();
     _orderFulfillmentService = Mock.Create <IOrderFulfillmentService>();
     _orderService            = new OrderService(_orderDataService, _customerService, _orderFulfillmentService);
 }
        public void Init()
        {
            _productRepository       = Substitute.For <IProductRepository>();
            _orderFulfillmentService = Substitute.For <IOrderFulfillmentService>();
            _taxRateService          = Substitute.For <ITaxRateService>();
            _customerRepository      = Substitute.For <ICustomerRepository>();
            _emailService            = Substitute.For <IEmailService>();

            _orderService = new OrderService(_productRepository, _orderFulfillmentService, _taxRateService,
                                             _customerRepository, _emailService);

            _orderConfirmation = new OrderConfirmation {
                CustomerId = 42, OrderId = 12, OrderNumber = "OneTwoThree"
            };
            _taxEntryList = new List <TaxEntry>
            {
                new TaxEntry {
                    Description = "Default", Rate = (decimal)0.2
                },
                new TaxEntry {
                    Description = "High", Rate = (decimal)0.5
                }
            };
            _customer = new Customer {
                CustomerId = 2, PostalCode = "12345", Country = "USA"
            };

            _taxRateService.GetTaxEntries(_customer.PostalCode, _customer.Country).Returns(_taxEntryList);
            _customerRepository.Get(_customer.CustomerId.Value).Returns(_customer);
        }
Exemple #7
0
		public ACIController(IOrderDocumentsService orderDocumentsService, IOrderFulfillmentService orderFulfillmentService, IOrderManager orderManager, IDocumentService documentService)
		{
			_orderDocumentsService = orderDocumentsService;
			_orderFulfillmentService = orderFulfillmentService;
			_documentService = documentService;
			_hotSpotDataFolder = new ConfigHelper().HotSpotDataFolder;
			_orderManager = orderManager;
		}
        public void Setup()
        {
            orderDataService = Mock.Create <IOrderDataService>();
            customerService  = Mock.Create <ICustomerService>();

            orderFulfillmentService = Mock.Create <IOrderFulfillmentService>();
            orderService            = new OrderService(orderDataService, customerService, orderFulfillmentService);
        }
Exemple #9
0
 public OrderService(IProductRepository productRepository, IOrderFulfillmentService orderFulfillment, ITaxRateService taxRateService, ICustomerRepository customerRepository, IEmailService emailService)
 {
     _productRepository  = productRepository;
     _orderFulfillment   = orderFulfillment;
     _taxRateService     = taxRateService;
     _customerRepository = customerRepository;
     _emailService       = emailService;
 }
 public OrderService(IOrderFulfillmentService orderFulfillmentService,
     ICustomerRepository customerRepository, ITaxRateService taxRateService,
     IEmailService emailService)
 {
     _orderFulfillmentService = orderFulfillmentService;
     _customerRepository = customerRepository;
     _taxRateService = taxRateService;
     _emailService = emailService;
 }
Exemple #11
0
 public OrderService(IOrderFulfillmentService orderFulfillment, IProductRepository productRepository, ICustomerRepository customerRepository, ITaxRateService taxRateService, IEmailService emailService)
 {
     _orderFulfillmentService = orderFulfillment;
     _productRepository       = productRepository;
     _customerRepository      = customerRepository;
     _taxRateService          = taxRateService;
     _emailService            = emailService;
     ExceptionReasons         = new List <string>();
 }
Exemple #12
0
 public OrderService(IOrderFulfillmentService orderFulfillmentService,
                     ICustomerRepository customerRepository, ITaxRateService taxRateService,
                     IEmailService emailService)
 {
     _orderFulfillmentService = orderFulfillmentService;
     _customerRepository      = customerRepository;
     _taxRateService          = taxRateService;
     _emailService            = emailService;
 }
 public OrderService(IProductRepository productRepository, IOrderFulfillmentService orderFulfillmentService, IEmailService emailService, ICustomerRepository customerRepository, ITaxRateService taxRateService)
 {
     _customerRepository = customerRepository;
     _productRepository = productRepository;
     _orderFulfillmentService = orderFulfillmentService;
     _emailService = emailService;
     _taxRateService = taxRateService;
     _reasonsForInvalidOrder = "";
 }
Exemple #14
0
		public UpdateOrderController(IOrderFulfillmentService orderFulfillmentService, IChangeTrackingRepository changeTrackingRepository,
			IAppraiserOrderDeliveryService appraiserOrderDeliveryService, ISecurityContext securityContext, IOrderService orderService, IConfigurationHelper configHelper)
		{
            _configHelper = configHelper;
			_orderFulfillmentService = orderFulfillmentService;
			_changeTrackingRepository = changeTrackingRepository;
			_appraiserOrderDeliveryService = appraiserOrderDeliveryService;
			_orderService = orderService;
		}
 public OrderAccountant(IWarehouseInventoryService warehouseInventoryService, IOrderFulfillmentService orderFulfillmentService, ITokenGenerator tokenGenerator, OrderSettings orderSettings, IOrderService orderService, IOrderItemService orderItemService, IPaymentProcessor paymentProcessor)
 {
     _warehouseInventoryService = warehouseInventoryService;
     _orderFulfillmentService   = orderFulfillmentService;
     _tokenGenerator            = tokenGenerator;
     _orderSettings             = orderSettings;
     _orderService     = orderService;
     _orderItemService = orderItemService;
     _paymentProcessor = paymentProcessor;
 }
Exemple #16
0
        public void SetUp()
        {
            _customerRepository      = Substitute.For <ICustomerRepository>();
            _productRepository       = Substitute.For <IProductRepository>();
            _orderFulfillmentService = Substitute.For <IOrderFulfillmentService>();
            _taxRateService          = Substitute.For <ITaxRateService>();
            _emailService            = Substitute.For <IEmailService>();

            this.orderService = new OrderService(this._orderFulfillmentService, this._productRepository, this._customerRepository, this._taxRateService, this._emailService);
        }
 public static void SetOrderFullfillmentReturn(this IOrderFulfillmentService orderFulfillment,
                                               Order order)
 {
     orderFulfillment.Fulfill(order).Returns(new OrderConfirmation
     {
         CustomerId  = 1,
         OrderId     = 2,
         OrderNumber = "1337"
     });
 }
 public void BeforeEach()
 {
     _orderFulfillment = Substitute.For <IOrderFulfillmentService>();
     _taxRateService   = Substitute.For <ITaxRateService>();
     _taxRateService.SetTaxRateServiceReturn();
     _customerRepository = Substitute.For <ICustomerRepository>();
     _customerRepository.SetCustomerRepoReturn();
     _emailService = Substitute.For <IEmailService>();
     _productRepo  = Substitute.For <IProductRepository>();
     _sut          = new OrderService(_productRepo, _orderFulfillment, _taxRateService, _customerRepository, _emailService);
 }
Exemple #19
0
        public void BeforeEach()
        {
            _mockIProductRepository = MockRepository.GenerateMock <IProductRepository>();

            _mockICustomerRepository = MockRepository.GenerateMock <ICustomerRepository>();

            _mockIEmailService = MockRepository.GenerateMock <IEmailService>();

            _mockIOrderFulfillmentService = MockRepository.GenerateMock <IOrderFulfillmentService>();

            _mockITaxRateService = MockRepository.GenerateMock <ITaxRateService>();
        }
Exemple #20
0
 public OrderService(IProductRepository productRepository,
                     ITaxRateService taxRateService,
                     IOrderFulfillmentService orderFulfillmentService,
                     IEmailService emailService,
                     string postalCode, string country)
 {
     _productRepository       = productRepository;
     _orderFulfillmentService = orderFulfillmentService;
     _productRepository       = productRepository;
     _taxRateService          = taxRateService;
     _postalCode = postalCode;
     _country    = country;
 }
 public OrderService(
     IProductRepository productRepo,
     IOrderFulfillmentService fulfillmentService,
     ICustomerRepository customerService,
     ITaxRateService taxService,
     IEmailService emailService)
 {
     _productRepo        = productRepo;
     _fulfillmentService = fulfillmentService;
     _customerService    = customerService;
     _taxService         = taxService;
     _emailService       = emailService;
 }
        public void SetUp()
        {
            // Arrange
            _mockProductRepository       = MockRepository.GenerateMock <IProductRepository>();
            _mockOrderFulfillmentService = MockRepository.GenerateMock <IOrderFulfillmentService>();
            _mockCustomerRepository      = MockRepository.GenerateMock <ICustomerRepository>();
            _mockTaxRateService          = MockRepository.GenerateMock <ITaxRateService>();
            _mockEmailService            = MockRepository.GenerateMock <IEmailService>();

            CreateOrderWithOneItem();

            _orderService = new OrderService(CustomerIdConstInt,
                                             _mockProductRepository,
                                             _mockOrderFulfillmentService,
                                             _mockCustomerRepository,
                                             _mockTaxRateService,
                                             _mockEmailService);
        }
		public OrderFulfillmentServiceTest()
		{
			_appraiserOrderRepository = Substitute.For<IAppraiserOrderRepository>();
			_clientDashboardService = Substitute.For<IClientDashboardService>();
			_clientManager = Substitute.For<IClientUserManager>();
			_orderRepository = Substitute.For<IOrderRepository>();
			_formsService = Substitute.For<IAppraisalFormsService>();
			_securityContext = Substitute.For<ISecurityContext>();
			_refManager = Substitute.For<IReferenceManagement>();
			_orderManager = Substitute.For<IOrderManager>();
			_changeTrackingRepository = Substitute.For<IChangeTrackingRepository>();
			_userManager = Substitute.For<IUsersManagement>();
			_orderHistoryManager = Substitute.For<IOrderHistoryManager>();
			_avmRequestsService = Substitute.For<IAvmRequestsService>();
			_taskManager = Substitute.For<ITaskManager>();
			_orderPeriodicalNotificationManager = Substitute.For<IOrderPeriodicalNotificationManager>();
			_target = new OrderFulfillmentService(_orderManager, _appraiserOrderRepository, _clientDashboardService, _clientManager,
				_orderRepository, _formsService, _securityContext, _refManager, _changeTrackingRepository, _userManager, _orderHistoryManager,
				_avmRequestsService, _taskManager, _orderPeriodicalNotificationManager);
		}
        public void BeforeEach()
        {
            _productRepo             = Substitute.For <IProductRepository>();
            _orderFulfillmentService = Substitute.For <IOrderFulfillmentService>();
            _customerRepository      = Substitute.For <ICustomerRepository>();
            _taxRateService          = Substitute.For <ITaxRateService>();
            _emailService            = Substitute.For <IEmailService>();

            _subject = new OrderService(_orderFulfillmentService,
                                        _customerRepository,
                                        _taxRateService,
                                        _emailService);

            _bestCustomer = new Customer
            {
                CustomerId = 42,
                PostalCode = "12345",
                Country    = "Merica"
            };

            _listOfTaxEntries = new List <TaxEntry>
            {
                new TaxEntry {
                    Description = "High Tax", Rate = (decimal)0.60
                },
                new TaxEntry {
                    Description = "Low Tax", Rate = (decimal)0.10
                }
            };

            _orderConfirmation = new OrderConfirmation
            {
                OrderId     = 1234,
                OrderNumber = "hello"
            };
            _customerRepository.Get(_bestCustomer.CustomerId.Value).Returns(_bestCustomer);
            _taxRateService.GetTaxEntries(_bestCustomer.PostalCode, _bestCustomer.Country).Returns(_listOfTaxEntries);
        }
Exemple #25
0
        public OrderServiceTests()
        {
            _customerRepository      = MockRepository.GenerateMock <ICustomerRepository>();
            _emailService            = MockRepository.GenerateMock <IEmailService>();
            _orderFulfillmentService = MockRepository.GenerateMock <IOrderFulfillmentService>();
            _productRepository       = MockRepository.GenerateMock <IProductRepository>();
            _taxRateService          = MockRepository.GenerateMock <ITaxRateService>();

            _taxEntries = new List <TaxEntry>()
            {
                CreateTaxEntry("test", 12),
                CreateTaxEntry("test2", 10)
            };

            _productRepository
            .Stub(p => p.IsInStock("product_1"))
            .Return(true);

            _productRepository
            .Stub(p => p.IsInStock("product_2"))
            .Return(true);

            var order = new Order();

            _orderFulfillmentService
            .Stub(o => o.Fulfill(order))
            .Return(new OrderConfirmation()
            {
                OrderNumber = "1001"
            });

            _taxRateService
            .Stub(t => t.GetTaxEntries(postalCode, country))
            .Return(_taxEntries);

            _orderService = new OrderService(_emailService, _orderFulfillmentService, _productRepository, _taxRateService, postalCode, country);
        }
 public void PlaceOrder_SetUp()
 {
     _customerRepository = MockRepository.GenerateMock<ICustomerRepository>();
     _emailService = MockRepository.GenerateMock<IEmailService>();
     _orderFulfillmentService = MockRepository.GenerateMock<IOrderFulfillmentService>();
     _productRepository = MockRepository.GenerateMock<IProductRepository>();
     _taxRateService = MockRepository.GenerateMock<ITaxRateService>();
 }