public async Task <long> CreateAsync(LocationAction action)
        {
            var savedAction = _context.LocationActions.Add(action);
            await _context.SaveChangesAsync();

            return(savedAction.Entity.Id);
        }
Esempio n. 2
0
        private async Task <string> DoLocationAction(LocationAction action, PlayerCharacter pc)
        {
            pc.LocationId = action.RelocateToId.Value;
            await _playerCharacterRepository.UpdateAsync(pc.Id, pc);

            return(action.SuccessMessageTemplate);
        }
Esempio n. 3
0
            public void ShouldThrowExceptionWhenValueIsMoreThan20Chars()
            {
                var action = new LocationAction();

                ExceptionAssert.Throws <InvalidOperationException>("The label cannot be longer than 20 characters.", () =>
                {
                    action.Label = new string('x', 21);
                });
            }
Esempio n. 4
0
            public void ShouldThrowExceptionWhenValueIsEmpty()
            {
                var action = new LocationAction();

                ExceptionAssert.Throws <InvalidOperationException>("The label cannot be null or whitespace.", () =>
                {
                    action.Label = string.Empty;
                });
            }
            public void ShouldNotThrowExceptionWhenValid()
            {
                IAction action = new LocationAction()
                {
                    Label = "Test"
                };

                action.Validate();
            }
            public void ShouldThrowExceptionWhenLabelIsNull()
            {
                IAction action = new LocationAction();

                ExceptionAssert.Throws <InvalidOperationException>("The label cannot be null.", () =>
                {
                    action.Validate();
                });
            }
Esempio n. 7
0
            public void ShouldNotThrowExceptionWhenValueIs20Chars()
            {
                var value = new string('x', 20);

                var action = new LocationAction()
                {
                    Label = value
                };

                Assert.AreEqual(value, action.Label);
            }
Esempio n. 8
0
        LocationAction Dispatch(LocationAction action)
        {
            lock (_syncRoot)
            {
                State = _locationReducer(State, action);
                DevToolsInterop.Log(action.ToString(), JsonUtil.Serialize(State));
                History.Add(new HistoricEntry <TState, object>(State, action));
            }

            OnChange(null);
            return(action);
        }
Esempio n. 9
0
        public static MyModel LocationReducer(MyModel state, LocationAction action)
        {
            var newState = MainReducer(state, null);

            switch (action)
            {
            case NewLocationAction a:
                newState.Location = a.Location;
                break;
            }

            return(newState);
        }
Esempio n. 10
0
        public void DisplayLocations()
        {
            InitialGameMenu initialGameMenu = InitialGameMenu.GetTownInstance();

            GameState.CurrentLocation = initialGameMenu.GetStartingLocationDefinition();

            GameState.CurrentLocation.LocationInstance.Display();
            LocationAction locationAction = GameState.CurrentLocation.LocationInstance.GetAction();

            while (!(locationAction is ExitGame))
            {
                // Do Action
                LocationDefinition newLocation = locationAction.DoAction();;

                GameState.CurrentLocation = newLocation;

                GameState.CurrentLocation.LocationInstance.Display();
                locationAction = GameState.CurrentLocation.LocationInstance.GetAction();
            }
        }
 public void OnLocationChanged(Location location)
 {
     _currentLocation = location;
     //adds the action after the first find.
     if (FoundLocation == false)
     {
         FoundLocation = true;
         RunOnUiThread(() =>
         {
             var locationMenuAction = new LocationAction(this, null, Resource.Drawable.location_place, this);
             LegacyBar.AddAction(locationMenuAction);
         });
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Retrieves a single Location object from the Api without querying for all locations inside the GROHE
        /// account.
        /// </summary>
        /// <param name="id">The location ID as retrieved by the GROHE Api</param>
        /// <returns>One specific Location</returns>
        public Location getLocation(int id)
        {
            LocationAction action = apiClient.getAction <LocationAction>();

            return(action.getLocation(id));
        }
Esempio n. 13
0
        /// <summary>
        /// Locations are the top-level organizational structure inside the GROHE account. They're most likely used to
        /// separate multiple buildings or houses within one account.
        /// </summary>
        /// <returns>The list of saved Locations in the GROHE account</returns>
        public List <Location> getLocations()
        {
            LocationAction action = apiClient.getAction <LocationAction>();

            return(action.getLocations());
        }
            public void ShouldNotThrowExceptionWhenActionIsLocationAction()
            {
                var action = new LocationAction();

                IActionExtensions.CheckActionType(action);
            }
 public async Task UpdateAsync(long id, LocationAction action)
 {
     await Task.FromResult(_context.LocationActions.Update(action));
 }