public void AddOperatorToEstateRequest_CanBeCreated_IsCreated() { AddOperatorToEstateRequest addOperatorToEstateRequest = AddOperatorToEstateRequest.Create(TestData.EstateId, TestData.OperatorId, TestData.OperatorName, TestData.RequireCustomMerchantNumberTrue, TestData.RequireCustomTerminalNumberTrue); addOperatorToEstateRequest.ShouldNotBeNull(); addOperatorToEstateRequest.EstateId.ShouldBe(TestData.EstateId); addOperatorToEstateRequest.OperatorId.ShouldBe(TestData.OperatorId); addOperatorToEstateRequest.Name.ShouldBe(TestData.OperatorName); addOperatorToEstateRequest.RequireCustomMerchantNumber.ShouldBe(TestData.RequireCustomMerchantNumberTrue); addOperatorToEstateRequest.RequireCustomTerminalNumber.ShouldBe(TestData.RequireCustomTerminalNumberTrue); }
public async Task <IActionResult> CreateOperator([FromRoute] Guid estateId, [FromBody] CreateOperatorRequest createOperatorRequest, CancellationToken cancellationToken) { Guid operatorId = Guid.NewGuid(); // Create the command AddOperatorToEstateRequest command = AddOperatorToEstateRequest.Create(estateId, operatorId, createOperatorRequest.Name, createOperatorRequest.RequireCustomMerchantNumber.Value, createOperatorRequest.RequireCustomTerminalNumber.Value); // Route the command await this.Mediator.Send(command, cancellationToken); // return the result return(this.Created($"{OperatorController.ControllerRoute}/{operatorId}", new CreateOperatorResponse { EstateId = estateId, OperatorId = operatorId })); }