As shown by the workflow diagram for the User Story work item below, if "code complete and unit tests pass" then put into "Resolved" state. If "Acceptance Tests fail", then put in "Active" state and re-assign to developer. Only go to "Closed" state if "Acceptance tests pass".
Further info can be found here.