public async Task GivenSignUpAccountHandler_WhenCallHandle_IfMemberNotFound_ShouldRaiseException() { // assign var query = new SignUpAccountCommand { MemberId = 1 }; _memberService.GetMemberById(query.MemberId).Returns(default(Member)); // act var exception = await Should.ThrowAsync <BusinessException>(() => _signUpAccountHandler.Handle(query, CancellationToken.None)); // assert exception.IsBadRequest.ShouldBeTrue(); exception.BusinessErrorMessage.ShouldContain("Invalid member details."); await _accountService.DidNotReceive().SignUpAccount(Arg.Any <Member>()); await _unitOfWork.DidNotReceive().SaveChangesAsync(CancellationToken.None); }