示例#1
0
        public async Task Context()
        {
            _serviceProvider = new ServiceProviderHelper().BuildServiceProvider();
            DomainEvents.Initialize(_serviceProvider.GetService <IDomainEventHandlerFactory>());

            _serviceScope = _serviceProvider.CreateScope();

            _unitOfWork = _serviceProvider.GetService <NhibernateUnitOfWork>();
            _unitOfWork.BeginTransaction();

            _shipCountBefore = _GetShipCount();

            var manageShipsController = new ManageShipsControllerBuilder(_serviceProvider).Build();

            var createNewShipCommand = new CreateNewShipCommand
            {
                ShipName  = "ship name",
                Tonnage   = 23.4m,
                ImoNumber = "IMO 12345"
            };

            _actionResult = await manageShipsController.CreateNewShip(createNewShipCommand);

            _unitOfWork.Flush();
            _unitOfWork.Clear();
        }
        public void Context()
        {
            _serviceProvider = new ServiceProviderHelper().BuildServiceProvider();
            _serviceScope    = _serviceProvider.CreateScope();

            _unitOfWork = _serviceProvider.GetService <NhibernateUnitOfWork>();
            _unitOfWork.BeginTransaction();

            var manageShipsController = new ManageShipsControllerBuilder(_serviceProvider).Build();

            _actionResult = manageShipsController.CreateNewShip();
        }