Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        public async Task Context()
        {
            _serviceProvider = new ServiceProviderHelper().BuildServiceProvider();
            _serviceScope    = _serviceProvider.CreateScope();

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

            _newShip = new ShipBuilder().Build();
            _unitOfWork.Save(_newShip);

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

            var updateShipCommand = new UpdateShipCommand
            {
                ShipId   = _newShip.Id,
                ShipName = "updated ship name",
                Tonnage  = 34.5m
            };

            _actionResult = await manageShipsController.UpdateShip(updateShipCommand);

            _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();
        }
Ejemplo n.º 4
0
        public async Task Context()
        {
            _serviceProvider = new ServiceProviderHelper().BuildServiceProvider();
            _serviceScope    = _serviceProvider.CreateScope();

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

            _newShip = new ShipBuilder().Build();
            _unitOfWork.Save(_newShip);

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

            _actionResult = await manageShipsController.Index();
        }