public void GetPointOfSale_ConstructsQuery_ReturnsResultOfDispatch() { var posId = TestIds.A; var result = new PointOfSaleDto(); _dispatcherMock.Setup(d => d.QueryAsync(It.Is <GetPointOfSale>(q => q.Id == posId))).ReturnsAsync(result).Verifiable(); var actionResult = _controller.GetPointOfSale(posId).GetAwaiter().GetResult(); Assert.AreEqual(actionResult.Value, result); _dispatcherMock.Verify(); }
public async Task <ActionResult> UpdatePointOfSale(Guid id, PointOfSaleDto posDto) { var pos = await _pointsOfSaleService.GetPointOfSale(id); if (pos is null) { return(new UnauthorizedObjectResult(new ErrorDto("point_of_sale_not_found", $"Could not find point of sale with ID '{id}'"))); } await _authLoader.AssertResourceAccessAsync(User, id, IsAuthorizedUserPolicy.Instance); if (pos.ParentAccountingGroupId != posDto.ParentAccountingGroupId) { await _accGroupAuthLoader.AssertResourceAccessAsync(User, posDto.ParentAccountingGroupId, IsAuthorizedUserPolicy.Instance); } return(await SendAndHandleOperationCommand(new UpdatePointOfSale(id, posDto.DisplayName, posDto.ParentAccountingGroupId, posDto.SaleStrategyId, posDto.Features))); }