public async Task UpdateCustomerAsync_更新成功_應該回傳1() { // arrange var customersUpdateDto = new CustomersUpdateDto { CustomerID = "Taco1", CompanyName = "Alfreds Futterkiste" }; var customersUpdateDbModel = new CustomersUpdateDbModel { CustomerID = "Taco1", CompanyName = "Alfreds Futterkiste" }; this._customerRepository.UpdateCustomerAsync(Arg.Is <CustomersUpdateDbModel> ( c => c.CustomerID == "Taco1" && c.CompanyName == "Alfreds Futterkiste" )).Returns(1); var sut = GetSystemUnderTest(); // expected int expected = 1; // act var actual = await sut.UpdateCustomerAsync(customersUpdateDto); // assert actual.Should().Be(expected); }
/// <summary> /// 更新客戶資料 /// </summary> /// <param name="customersUpdateDataModel">客戶UpdateDataModel</param> /// <returns></returns> public async Task <int> UpdateCustomerAsync(CustomersUpdateDbModel customersUpdateDataModel) { return(await this.sqlHelper.CustomExecuteAsync(this._connectionHelper.GetNorthwindConnection(), async (conn, trans) => { var result = await conn.ExecuteAsync(this.UpdateCustomerAsyncSQL, customersUpdateDataModel, trans); return result; })); }