예제 #1
0
        public async Task given_an_idenfier_for_delete_charge_and_dont_exist_we_obtein_a_false_response()
        {
            clientChargeRepository.DeleteCharge(identifier).Returns(false);
            var deleteChargeAction = new DeleteChargeAction(clientChargeRepository);

            var result = await deleteChargeAction.Execute(identifier);

            result.Should().Be(false);
            await clientChargeRepository.Received(1).DeleteCharge(identifier);
        }
        public async Task given_an_identifier_try_delete_not_exist_charge_return_not_found_response()
        {
            var requestUri            = string.Format("http://localhost:10000/api/charges/charge/{0}", identifier);
            DeleteChargeAction action = GivenAnDeleteChargeActionMock();

            action.Execute(Arg.Any <string>()).Returns(false);
            var result = await client.DeleteAsync(requestUri);

            result.StatusCode.Should().Be(HttpStatusCode.NotFound);
            await action.Received(1).Execute(identifier);
        }
 private static void ReturnsExceptionFor(DeleteChargeAction action, string messageException)
 {
     action.Execute(Arg.Any <string>()).Throws(new ChargesException(messageException));
 }