private async Task PostData(int id = 0, double frets = 0, double scale = 0) { var testdata = await TestDataProcessor.PostTestData(id, frets, scale); fretAmount = testdata.FretAmount; scaleLength = testdata.ScaleLength; tdata.FretAmount = fretAmount; tdata.ScaleLength = scaleLength; }
// Calling the API test data and assigning it to test varibles private async Task LoadData(int testIdNumber = 0) { var testdata = await TestDataProcessor.LoadTestData(testIdNumber); fretAmount = testdata.FretAmount; scaleLength = testdata.ScaleLength; tdata.FretAmount = fretAmount; tdata.ScaleLength = scaleLength; }
public async Task FailedToDeleteTestEntry(int id) { // GIVEN //// The connection to the DB is active // WHEN //// The user tries to delete a data entry that doesnt exist // THEN //// The system throws an excpetion //// and displays a log message //// "Unable to delete data entry for key -- TestId: { id }" await Assert.ThrowsAsync <Exception>(() => TestDataProcessor.DeleteTestData(id)); }
public async Task AddNewEntryToDatabaseThenDelete(int id, double frets, double scale) { // GIVEN // Posts data to database for test await PostData(id, frets, scale); int expectedStatusCode = 204; // Expects a "204 No Content" status code after deletion // WHEN // The data is deleted from the DB var testdataStatusCode = await TestDataProcessor.DeleteTestData(id); // THEN // The data entry is no longer in the DB Assert.Equal(expectedStatusCode, testdataStatusCode); }