Exemplo n.º 1
0
 public void TryAccept(ICargo cargo)
 {
     if (_cargos == null)
     {
         _cargos = new List <ICargo>();
     }
     _cargos.Add(cargo);
 }
Exemplo n.º 2
0
        public RoutingService(string rerouteFrom, string rerouteTo, ICargo cargo)
        {
            Contract.Requires(cargo != null);

            Cargo       = cargo;
            RerouteFrom = rerouteFrom;
            RerouteTo   = rerouteTo;
        }
Exemplo n.º 3
0
        public void Ctor_withNullUser_throwsArgumentNullException(EventType type)
        {
            // arrange:
            ICargo   cargo          = MockRepository.GenerateStrictMock <ICargo>();
            DateTime completionDate = DateTime.UtcNow;

            // assert:
            Assert.Throws <ArgumentNullException>(delegate { new Event(null, cargo, type, completionDate); });
        }
 public void Reroute()
 {
     reroutedCargo =
         new RoutingService(
             rerouteFrom: RerouteFrom,
             rerouteTo: RerouteTo,
             cargo: this.Cargo.Cargo
             ).Reroute();
 }
Exemplo n.º 5
0
 private void ReleaseCargo()
 {
     if (myCargo != null)
     {
         var delta = DirectionVector();
         myCargo.Release(delta * leaveOffset);
         myCargo = null;
     }
 }
Exemplo n.º 6
0
 public BookShop(ICargo Cargo)
 {
     cargo       = Cargo;
     currUser    = null;
     clients     = new Client[10];
     logData     = new ILoginable[10];
     usedClients = 0;
     publicTrash = new Trash();
     CreateUser(new Person("Admin", "Admin", "000000000"), "admin", LoginPass.Hasher("admin"), "localhost");
 }
Exemplo n.º 7
0
 void LoadCargo(ICargo c)
 {
     if (CurrentCargo + c.GetSize() <= MaxCargo)
     {
         if (c.Load())
         {
             Cargo.Add(c);
             c.SetLocation(this);
         }
     }
 }
Exemplo n.º 8
0
 public Car(
     string model,
     IEngine engine,
     ICargo cargo,
     ITire[] tires
     )
 {
     this.model  = model;
     this.Engine = engine;
     this.Cargo  = cargo;
     this.Tires  = tires;
 }
Exemplo n.º 9
0
		public Event (IUser user, ICargo cargo, EventType type, DateTime completionDate)
		{
			if(null == user)
				throw new ArgumentNullException("user");
			if(null == cargo)
				throw new ArgumentNullException("cargo");
			
			_user = user.Username;
			_completionDate = completionDate;
			_cargo = cargo.TrackingId;
			_location = cargo.Delivery.LastKnownLocation;
			_voyage = cargo.Delivery.CurrentVoyage;
			_type = type;
		}
Exemplo n.º 10
0
 public StatusProcessor(ILogger <StatusProcessor> log, IShip ship, ICommander commander, INavRoute navRoute,
                        ICargo cargo, IMarket market, IModules modules, IBackpack backpack, IShipyard shipyard,
                        IOutfitting outfitting, IFileReader fileReader)
 {
     _log        = log;
     _ship       = ship;
     _commander  = commander;
     _navRoute   = navRoute;
     _cargo      = cargo;
     _market     = market;
     _modules    = modules;
     _backpack   = backpack;
     _shipyard   = shipyard;
     _outfitting = outfitting;
     _fileReader = fileReader;
     _cache      = new Dictionary <string, string>();
 }
Exemplo n.º 11
0
        public Event(IUser user, ICargo cargo, EventType type, DateTime completionDate)
        {
            if (null == user)
            {
                throw new ArgumentNullException("user");
            }
            if (null == cargo)
            {
                throw new ArgumentNullException("cargo");
            }

            _user           = user.Username;
            _completionDate = completionDate;
            _cargo          = cargo.TrackingId;
            _location       = cargo.Delivery.LastKnownLocation;
            _voyage         = cargo.Delivery.CurrentVoyage;
            _type           = type;
        }
Exemplo n.º 12
0
            public virtual void OnNewCargo(ICargo cargo)
            {
                if (cargo == null)
                {
                    return;
                }
                if (owner.HasCargo)
                {
                    return;
                }

                if (cargo.CanGetIntoBoat())
                {
                    cargo.GetIntoBoat(owner);
                    owner.myCargo = cargo;
                    owner.timeWhenCargoEntered = Time.time;
                }
            }
Exemplo n.º 13
0
 void CalculateCargo()
 {
     foreach (ICargo c in Cargo)
     {
         CurrentCargo += c.GetSize();
     }
     while (CurrentCargo > MaxCargo)
     {
         int    i = random.Next(0, Cargo.Count);
         ICargo z = Cargo [i];
         Cargo.Remove(z);
         z.DestroyCargo();
         CurrentCargo = 0;
         foreach (ICargo c in Cargo)
         {
             CurrentCargo += c.GetSize();
         }
     }
 }
        public bool AddCargo(ICargo cargo, ICargoContainer container)
        {
            if (CanAddCargoMore(cargo.Type, container) < cargo.Count)
            {
                return(false);
            }


            var existedCargo = container.Cargos.Collection.FirstOrDefault(c => c.Type == cargo.Type);

            if (existedCargo != null)
            {
                existedCargo.Count += cargo.Count;
            }
            else
            {
                container.Cargos.Add(cargo);
            }

            return(true);
        }
Exemplo n.º 15
0
        public void Ctor_withValidArgs_works(EventType type)
        {
            // arrange:
            List <object> mocks  = new List <object>();
            Username      userId = new Username("Giacomo");
            IUser         user   = MockRepository.GenerateStrictMock <IUser>();

            user.Expect(u => u.Username).Return(userId).Repeat.Once();
            mocks.Add(user);
            TrackingId   cargoId  = new TrackingId("CARGO001");
            UnLocode     location = new UnLocode("UNLOC");
            VoyageNumber voyage   = new VoyageNumber("VYG001");
            ICargo       cargo    = MockRepository.GenerateStrictMock <ICargo>();

            cargo.Expect(c => c.TrackingId).Return(cargoId).Repeat.Once();
            IDelivery delivery = MockRepository.GenerateStrictMock <IDelivery>();

            delivery.Expect(d => d.LastKnownLocation).Return(location).Repeat.Once();
            delivery.Expect(d => d.CurrentVoyage).Return(voyage).Repeat.Once();
            mocks.Add(delivery);
            cargo.Expect(c => c.Delivery).Return(delivery).Repeat.Twice();
            mocks.Add(cargo);
            DateTime completionDate = DateTime.UtcNow;

            // act:
            IEvent underTest = new Event(user, cargo, type, completionDate);

            // assert:
            Assert.AreSame(userId, underTest.User);
            Assert.AreSame(cargoId, underTest.Cargo);
            Assert.AreSame(location, underTest.Location);
            Assert.AreSame(voyage, underTest.Voyage);
            Assert.AreEqual(completionDate, underTest.Date);
            Assert.AreEqual(type, underTest.Type);
            foreach (object mock in mocks)
            {
                mock.VerifyAllExpectations();
            }
        }
Exemplo n.º 16
0
        public void CheckCargo(ICargo cargo)
        {
            if (!_canGetCargo || _orderQueue.Count == 0)
            {
                return;
            }

            if (cargo.cargoType != _orderQueue.Peek().cargoType)
            {
                OrderCancel();
                return;
            }

            _orderQueue.Dequeue();
            _guiScript.UpdateCargoLeftValue(_orderQueue.Count);
            if (_orderQueue.Count == 0)
            {
                OrderComplete();
                return;
            }
            _guiScript.UpdateCargoImage(_orderQueue.Peek().cargoImage);
        }
Exemplo n.º 17
0
 public void Load(ICargo cargo)
 {
     Cargos.Add(cargo);
 }
Exemplo n.º 18
0
 public bool has_the_same_identity_as(ICargo the_other_entity)
 {
     return the_other_entity != null &&
            underlying_tracking_id.has_the_same_value_as(the_other_entity.tracking_id());
 }
Exemplo n.º 19
0
 public PessoaController(IPessoa _repository, ICargo _cargoRepository, IPerfil _perfilRepository)
 {
     Repository        = _repository;
     Cargo_Repository  = _cargoRepository;
     Perfil_Repository = _perfilRepository;
 }
 public void AcceptCargo(ICargo cargo)
 {
     this._cargos.Add(cargo);
 }
Exemplo n.º 21
0
 public void Receive(ICargo cargo)
 {
     _spaceshipCargoKeeper.AddCargo(cargo);
 }
Exemplo n.º 22
0
 public void Accept(ICargo cargo)
 {
     _cargos.Add(cargo);
 }
Exemplo n.º 23
0
 public CargoController(ICargo cargoRepo, ILogger <CargoController> logger)
 {
     this.cargoRepo = cargoRepo;
     _logger        = logger;
 }
Exemplo n.º 24
0
 public void SetCargoMethod(ICargo cargo)
 {
     this.cargo = cargo;
 }
 public void Reroute()
 {
     _reroutedCargo = new RoutingService(rerouteFrom: _rerouteFrom, rerouteTo: _rerouteTo, cargo: _cargo.Cargo).Reroute();
 }
Exemplo n.º 26
0
 public FuncionariosController(IFuncionario funcionario, ICargo cargo)
 {
     _funcionario = funcionario;
     _cargo       = cargo;
 }
 public CargoController(ICargo _repository)
 {
     Repository = _repository;
 }
Exemplo n.º 28
0
 public void ReceiveCargo(ICargo cargo)
 {
     _orderManager.CheckCargo(cargo);
 }
 public RoutingService(string rerouteFrom, string rerouteTo, ICargo cargo)
 {
     Cargo       = cargo ?? throw new ArgumentNullException(nameof(cargo));
     RerouteFrom = rerouteFrom;
     RerouteTo   = rerouteTo;
 }
 public CargoController(ICargo cargo)
 {
     _cargo = cargo;
 }
 public void AddCargo(ICargo cargo)
 {
     _cargos.Add(cargo);
 }