コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 public Customer Create([FromBody] Customer customer)
 {
     return(_createCustomerCommand.Run(customer));
 }