コード例 #1
0
        public void CheckDrawSingleCard()
        {
            var cureDeck  = new CureDeckManager(locationManager);
            var location  = locationManager.GetLocations().First();
            var drawnCard = cureDeck.DrawCard();

            Assert.AreEqual <Location>(location, drawnCard);
        }
コード例 #2
0
        public CureDeckManager(ILocationManager locationManager)
        {
            _deck    = new List <Location>();
            _discard = new List <Location>();

            _deck.AddRange(locationManager.GetLocations());
            _deck.ShuffleDeck();
        }
コード例 #3
0
        public InfectionDeckManager(ILocationManager locationManager)
        {
            _drawDeck    = new List <Location>();
            _discardDeck = new List <Location>();
            _redrawDeck  = new List <Location>();

            _drawDeck.AddRange(locationManager.GetLocations());
            _drawDeck.ShuffleDeck <Location>();
        }
コード例 #4
0
 public BoardStateManager(ILocationManager locationManager)
 {
     _outbreakCount   = 0;
     _locationManager = locationManager;
     _boardLocations  = new Dictionary <Location, IDictionary <DiseaseColour, int> >();
     foreach (Location location in _locationManager.GetLocations())
     {
         IDictionary <DiseaseColour, int> cubeCounts = new Dictionary <DiseaseColour, int>();
         foreach (DiseaseColour colour in Enum.GetValues(typeof(DiseaseColour)))
         {
             cubeCounts.Add(colour, 0);
         }
         _boardLocations.Add(location, cubeCounts);
     }
 }
コード例 #5
0
        public async Task <IActionResult> Get(Guid requesterId, Guid eventId)
        {
            logger.LogInformation("Getting location");

            //validate
            string message = await locationManager.ValidateLocationRequest(requesterId, eventId);

            if (!string.IsNullOrEmpty(message))
            {
                return(BadRequest(message));
            }

            //put try catch only when you want to return custom message or status code, else this will
            //be caught in ExceptionHandling middleware so no need to put try catch here
            var result = locationManager.GetLocations(eventId);

            return(new OkObjectResult(result.Keys.Select(key => new { UserId = key, Location = result[key] })));
        }
コード例 #6
0
 public Task <IEnumerable <Location> > GetLocations()
 {
     return(_locationManager.GetLocations());
 }
コード例 #7
0
 // GET: Locations
 public async Task <IActionResult> Index()
 {
     return(View(await _context.GetLocations()));
 }