public async Task GetGarageById_UnknownIDPassed_ReturnsNotFoundResult() { //Arrange var random = new Random(); var invalidID = random.Next(1000, 2000); // Act await Context.Authenticate("ParkBee", "ParkBee"); var notFoundResult = await _controller.GetGarageInformation(invalidID); // Assert Assert.IsNull(notFoundResult); }
public async Task <Garage> RefreshGarage(int id) { var garage = new Garage(); using (var bc = new BusinessController()) garage = bc.GetGarageInformation(id).Result; garage = await ValidateGarageStatusBasedOnDoorStatuses(garage); return(garage); }
public async Task <Garage> GetUserGarageInformation() { var garage = new Garage(); var handler = new JwtSecurityTokenHandler(); var jwtToken = handler.ReadToken(Context.TokenModel.Token) as JwtSecurityToken; var garageID = Int32.Parse(jwtToken.Claims.First(claim => claim.Type == "garageid").Value); using (var bc = new BusinessController()) garage = bc.GetGarageInformation(garageID).Result; garage = await ValidateGarageStatusBasedOnDoorStatuses(garage); return(garage); }