Using the Arrange Act Assert what should be in the Arrange “section” considering that this is an integration test on my database?
private void Delete_Release_Test_Data(string conString)
{
UnitTestHelper.PrepareData(new[] { "ReleaseId" }, new object[] { 100 });
UnitTestHelper.InsertPreparedData(conString, RELEASE_TABLE);
}
[Test]
public void Delete_Release(string conString)
{
Delete_Release_Test_Data(conString);
// ARRANGE
// What should I put here ???
// ACT
IReleaseDataProvider provider = new ReleaseDataProvider();
provider.DeleteRelease(100);
// ASSERT
Assert.IsTrue(UnitTestHelper.HasNoData(conString, string.Format("SELECT * FROM {0}", RELEASE_TABLE)));
}
Is there a specific reason why the first line
Delete_Release_Test_Data(conString)isn’t under arrange? From this link on Arrange Act Assert:Inserting valid test data is a precondition of this test which means that it should be placed under the Arrange section.
Note: You can also rename this test to
Delete_Release_When_Existsand then also create a testDelete_Release_When_Doesnt_Existto verify the correct exception is thrown or return value is correct.