public async Task <IActionResult> GetMyAccountsSummary([FromBody] MyAccountsSummaryDto model) { // TODO: review versus proxy behavaviour and other controllers if (!ModelState.IsValid) { return(new BadRequestResult()); } var result = await _myAccountsService.GetMyAccountsSummary(model.AccountId); return(Ok(result)); }
public void AccountId_WhenValidateViaAttribute_WithValidId_Then_ReturnsNoError(string testAccountId) { MyAccountsSummaryDto model = new MyAccountsSummaryDto(); model.AccountId = testAccountId; { ValidationResult result = _validator.Validate(model); Assert.AreEqual(true, result.IsValid); Assert.AreEqual(0, result.Errors.Count); } }
public void AccountId_WhenValidateViaAttribute_WithEmpatyId_Then_ReturnsError(string testAccountId) { MyAccountsSummaryDto model = new MyAccountsSummaryDto(); model.AccountId = testAccountId; { ValidationResult result = _validator.Validate(model); Assert.AreEqual(false, result.IsValid); Assert.AreEqual(1, result.Errors.Count); Assert.AreEqual("AccountId", result.Errors[0].PropertyName); Assert.AreEqual("Must not be empty", result.Errors[0].ErrorMessage); } }