public async Task get_balance_should_return_error() { try { string number = "423434324"; var result = Task.FromResult <BankAccountModel>(null); _mockBankAccountService.Setup(x => x.GetAccount(number)).Returns(result); var response = await _bancAccountController.Balance(number) as HttpResponseMessage; var content = response.Content as ObjectContent; ResponseMessage responseMessage = content.Value as ResponseMessage; responseMessage.Message.Should().Be("Invalid Acount Number"); responseMessage.Successfull.Should().BeFalse(); } catch (Exception ex) { throw ex; } }