Exemple #1
0
        public ShipControllerTests()
        {
            _shipService  = Substitute.For <IShipService>();
            _boardService = Substitute.For <IBoardService>();

            _shipController = new ShipController(_shipService, _boardService);
        }
Exemple #2
0
        public static Task <SubmitWeightResultCodes> Execute(IShipService myShipService, IScale myScale,
                                                             int intIdIinventory,
                                                             string strManualEntryWeight, bool blnUseScale)
        {
            decimal decWeight;

            KeyValuePair <bool, decimal> weightResult;

            if (blnUseScale)
            {
                weightResult = myScale.ReadWeightFromScale();
                if (!weightResult.Key)
                {
                    return(Task.Factory.StartNew(() => SubmitWeightResultCodes.WeightIsTooLow));
                }
            }
            else
            {
                weightResult = GetManualEntryWeight.Execute(strManualEntryWeight);
                if (!weightResult.Key)
                {
                    return(Task.Factory.StartNew(() => SubmitWeightResultCodes.FailedToReadScale));
                }
            }

            decWeight = weightResult.Value;

            if (!BusinessRules.IsWeightAcceptable.Execute(decWeight))
            {
                return(Task.Factory.StartNew(() => SubmitWeightResultCodes.FailedToReadScale));
            }

            return(myShipService.SubmitWeight(intIdIinventory, decWeight));
        }
Exemple #3
0
        public ShipCollectionService(IShipService shipService)
        {
            ShipModels   = new List <ShipModel>();
            _shipService = shipService;

            _random = new Random();
        }
Exemple #4
0
 public LoginControlPresenter(ILoginControl view, LoginViewModel model, IShipService shipService)
 {
     View        = view;
     Model       = model;
     ShipService = shipService;
     View.BindToViewModel(model);
     View.SubmitButtonPressed += LoginControl_SubmitButtonPressed;
 }
        public PurchaseService(ApplicationDbContext applicationDbContext, IRestrictionsService restrictionsService, IHttpContextAccessor httpContextAccessor, IBuildingService buildingService, IShipService shipService)
        {
            this.restrictionsService = restrictionsService;
            this.buildingService     = buildingService;
            this.shipService         = shipService;
            var user = httpContextAccessor.HttpContext.User.Claims.FirstOrDefault(c => c.Type == "Username").Value;

            kingdom = applicationDbContext.Kingdoms.Include(k => k.User).Include(k => k.Ships).Include(k => k.Buildings).FirstOrDefault(k => k.User.Username == user);
        }
Exemple #6
0
 public MainFormPresenter(IMainForm view, MainFormViewModel model, Dictionary <Constants.Pages, Control> myPages)
 {
     _shipService = new ShipService();
     _scale       = new UsbScale();
     _printer     = new DatamaxPrinter();
     _view        = view;
     _model       = model;
     _pages       = myPages;
 }
 public BattleShipGameService(IDrawService drawService,
                              IMapService mapService,
                              IBattleService battleService,
                              IShipService shipService)
 {
     this.drawService   = drawService;
     this.mapService    = mapService;
     this.battleService = battleService;
     this.shipService   = shipService;
 }
Exemple #8
0
        public MainFormPresenter(IMainForm view, IShipService shipService, IScale myScale, IPrinter myPrinter, MainFormViewModel viewModel)
        {
            _shipService = shipService;
            _scale       = myScale;
            _printer     = myPrinter;
            _view        = view;
            _model       = viewModel;

            _view.BindToViewModel(viewModel);
            _pages = new Dictionary <Constants.Pages, Control>();
        }
Exemple #9
0
        public ShipControlPesenter(IShipControl view, ShipViewModel model, IShipService shipService, IScale myScale, IPrinter myPrinter)
        {
            _view        = view;
            _model       = model;
            _shipService = shipService;
            _scale       = myScale;
            _printer     = myPrinter;
            _view.BindToViewModel(model);
            _view.SubmitIdInventoryButtonPressed      += ShipControl_SubmitIdInventoryButtonPressed;
            _view.SubmitWeightButtonPressed           += ShipControl_SubmitWeightButtonPressed;
            _view.CancelButtonPressed                 += ShipControl_CancelButtonPressed;
            _view.GoToCustomizeScalePageButtonPressed += ShipControl_GoToCustomizeScalePageButtonPressed;

            UpdateState(ShipStates.WaitingForIdInventory);
        }
Exemple #10
0
        public static async Task <SubmitIdInventoryResult> Execute(IShipService myShipService, string strIdInventoryInput)
        {
            if (strIdInventoryInput.Length == 0)
            {
                return(new SubmitIdInventoryResult());
            }

            int intIdInventory;

            if (!int.TryParse(strIdInventoryInput, out intIdInventory))
            {
                return(new SubmitIdInventoryResult());
            }
            //return Task.Factory.StartNew(() => new SubmitIdInventoryResult());

            var result = await myShipService.SubmitIdInventory(intIdInventory);

            return(new SubmitIdInventoryResult(result, intIdInventory));
        }
Exemple #11
0
 public ShipController(IShipService shipService, IBoardService boardService)
 {
     _shipService  = shipService;
     _boardService = boardService;
 }
 public ShipController(IShipService shipService)
 {
     _shipService = shipService;
 }
Exemple #13
0
 public ShipController(ILogger <ShipController> logger, IShipService shipService)
 {
     _logger      = logger;
     _shipService = shipService;
 }
 public static Task <bool> Execute(IShipService myShipService, string strUserName, string strPassword)
 {
     return(myShipService.LoginIsValid(strUserName, strPassword));
 }
Exemple #15
0
 public App(IGridService gridService, IShipService shipService)
 {
     _gridService = gridService;
     _shipService = shipService;
 }
 public ShipController(IShipService shipService, IPurchaseService purchaseService, ITimeService timeService)
 {
     this.shipService     = shipService;
     this.purchaseService = purchaseService;
     this.timeService     = timeService;
 }
Exemple #17
0
 public PlayerController(IShipService shipService, IBoardService boardService, IAttackService attackService)
 {
     _shipService   = shipService;
     _boardService  = boardService;
     _attackService = attackService;
 }
Exemple #18
0
 public BoardController(IBoardService boardService, IShipService shipService, IAttackService attackService)
 {
     _boardService  = boardService;
     _shipService   = shipService;
     _attackService = attackService;
 }
 public ShipCommandHandler(IShipService shipService)
 {
     this.shipService = shipService;
 }
 private void createServices()
 {
     timeService = new TimeService();
     eventService = new EventService();
     uiFactoryService = new UIFactoryService();
     wwwService = new FakeWwwService();//controller.GameObject.AddComponent<WwwService>();
     viewService = new ViewService(eventService, uiFactoryService);
     loadService = new LoadService(eventService);
     gameService = new GameService(pool, viewService);
     pathService = new PathService(pool, wwwService, eventService);
     levelService = new LevelService(wwwService, eventService);
     enemyService = new EnemyService(pool, wwwService, eventService);
     bonusService = new BonusService(pool, wwwService, eventService);
     difficultyService = new DifficultyService(pool, wwwService, eventService);
     infoService = new InfoService(viewService, uiFactoryService, eventService);
     settingsService = new SettingsService(pool);
     translationService = new TranslationService(settingsService);
     languageService = new LanguageService(wwwService, eventService);
     analyticsService = new AnalyticsService(settingsService);
     shipService = new ShipService(timeService, eventService);
     gamerService = new GamerService(eventService);
     currencyService = new CurrencyService(eventService, gamerService);
     iapService = new IAPService(eventService);
     adService = new AdService(currencyService);
     shopService = new ShopService(currencyService, eventService, iapService);
     updateables.Add(infoService);
 }