When writing an evaluation for regularly saved data, I develop an evaluation like:

[TestMethod]
public void DoCreateDeleteTest() {
    PersistentDataStore pds = new PersistentDataStore();
    bool createSuccess = pds.Save("id", "payload");
    Assert.AreEqual(true, createSuccess);
    bool deleteSuccess = pds.Delete("id");
    Assert.AreEqual(true, deleteSuccess);
}

As lengthy as everything works, this appears fine. The function doesn't have prior dependencies also it cleans up after itself. The issue is: once the .Save() method works the save but returns false/failure. The assertion fires and also the remove isn't known as therefore it does not cleanup after itself.

Following this, there's endured data within the database with title "id" and all sorts of future saves fail.

The only method I'm able to want to circumvent it's to perform a preventive remove prior to the save, but that appears like method to large a hack.

Place the remove inside a method marked using the TestCleanup attribute (I suppose you're using MSTest).

Incidentally your test can also be testing two various things: if the save works and in addition it tests the remove. Tests should only test one factor at any given time.

Wrap both inside the one transaction? Perform a remove inside a catch?