public void CreateShouldCreateNewCustomer() { // Given A.CallTo(() => _createCustomerCommand.Run(Constants.CoolCustomer)).Returns(Constants.CoolCustomer); // When var customer = _customersController.Create(Constants.CoolCustomer); // Then Assert.Equal(Constants.CoolCustomer, customer); A.CallTo(() => _createCustomerCommand.Run(Constants.CoolCustomer)).MustHaveHappened(); }
public void RunShouldCreateNewCustomer() { // Given var newCreatedGuid = Guid.NewGuid(); A.CallTo(() => _dapperService.ExecuteScalar <Guid>(A <string> .Ignored, A <object> .Ignored)) .Returns(newCreatedGuid); // When var customer = _createCustomerCommand.Run(Constants.CoolCustomer); // Then Assert.Equal(newCreatedGuid, customer.Id); A.CallTo(() => _dapperService.ExecuteScalar <Guid>(A <string> .Ignored, A <object> .Ignored)) .MustHaveHappened(); }
public Customer Create([FromBody] Customer customer) { return(_createCustomerCommand.Run(customer)); }