public AllocationList Execute(ListAllocationsRequest request)
 {
     return(new AllocationList
     {
         Allocations = _databaseGateway.SelectAllocations(request.MosaicId, request.WorkerId, request.WorkerEmail)
     });
 }
        public IActionResult GetAllocations([FromQuery] ListAllocationsRequest request)
        {
            var validator         = new ListAllocationsRequestValidator();
            var validationResults = validator.Validate(request);

            if (!validationResults.IsValid)
            {
                return(BadRequest(validationResults.ToString()));
            }

            return(Ok(_allocationUseCase.Execute(request)));
        }
예제 #3
0
        public void ListAllocationsByWorkerEmail()
        {
            var request = new ListAllocationsRequest()
            {
                WorkerEmail = "*****@*****.**"
            };
            var gatewayResponse = new List <Allocation> {
                new Allocation()
                {
                    AllocatedWorker = "Test Worker"
                }
            };

            _mockDatabaseGateway.Setup(x => x.SelectAllocations(0, 0, "*****@*****.**"))
            .Returns(gatewayResponse);

            var response = _allocationsUseCase.Execute(request);

            response.Allocations.Should().BeEquivalentTo(gatewayResponse);
        }
 public void SetUp()
 {
     _request = new ListAllocationsRequest();
 }