public CommandsTest() { // repositories var productRepository = new ProductFakeRepository(); var customerRepository = new CustomerFakeRepository(); var cuponDisountRepository = new DiscountCuponFakeReaderRepository(); _products = productRepository.Take(10); _customer = customerRepository.GetByDocument(new Document("94763001086")); _creditCardCommand = new CreditCardCommand() { Cvv = 503, Number = "5361004355915434", PrintName = "Nicolas S. dos Santos", Validate = "16/06/2020", }; var orderRepository = new OrderFakeRepository(customerRepository.GetAll(), _products); // mock order _order = orderRepository.GetFirst(); // dependencies var notifications = new DomainNotificationHandler(); var uow = new UnitOfWorkFake(); var bus = new MediatorHandlerFake(notifications); // tests global dependencies _customerRepository = customerRepository; _productRepository = productRepository; _orderRepository = orderRepository; _cuponDisountRepository = cuponDisountRepository; // domain services var discountCuponDomainService = new DiscountCuponDomainService(bus, _cuponDisountRepository); _commandHanddler = new OrderCommandHandler( discountCuponDomainService, _orderRepository, _productRepository, _customerRepository, uow, bus, notifications); }
public DomainServiceTest() { var productRepository = new ProductFakeRepository(); var customerRepository = new CustomerFakeRepository(); var cuponDisountRepository = new DiscountCuponFakeReaderRepository(); // dependencies var notifications = new DomainNotificationHandler(); var bus = new MediatorHandlerFake(notifications); var repository = new DiscountCuponFakeReaderRepository(); var orderRepository = new OrderFakeRepository(customerRepository.GetAll(), productRepository.Take(10)); _order = orderRepository.GetFirst(); _notifications = notifications; _service = new DiscountCuponDomainService(bus, repository); }