コード例 #1
0
ファイル: Create.cs プロジェクト: sdemaine/FleetControl_CQRS
        public async Task GivenCreateCustomerCommand_ReturnsSuccessStatusCode()
        {
            var command = new CreateNorthwindCustomerCommand
            {
                CustomerId   = "ABCDE",
                Address      = "Obere Str. 57",
                City         = "Berlin",
                CompanyName  = "Alfreds Futterkiste",
                ContactName  = "Maria Anders",
                ContactTitle = "Sales Representative",
                Country      = "Germany",
                Fax          = "030-0076545",
                Phone        = "030-0074321",
                PostalCode   = "12209"
            };

            var content = Utilities.GetRequestContent(command);

            var response = await _client.PostAsync($"/api/customers/create", content);

            response.EnsureSuccessStatusCode();
        }
コード例 #2
0
        public async Task <IActionResult> Create([FromBody] CreateNorthwindCustomerCommand command)
        {
            await Mediator.Send(command);

            return(NoContent());
        }