示例#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()));
 }