public void DataService_AddSimpleTerm_Adds_Record_On_Valid_Term() { //Arrange int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName); DataUtil.AddDatabaseObject(virtualScriptFilePath, addSimpleTerm); Term term = ContentTestHelper.CreateValidSimpleTerm(Constants.VOCABULARY_ValidVocabularyId); DataService ds = new DataService(); //Act int termItemId = ds.AddSimpleTerm(term, Constants.USER_ValidId); //Assert DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName, rowCount + 1); }
public void DataService_AddSimpleTerm_Throws_On_InValid_VocabularyId() { //Arrange int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName); DataUtil.AddDatabaseObject(virtualScriptFilePath, addSimpleTerm); Term term = ContentTestHelper.CreateValidSimpleTerm(Constants.VOCABULARY_InValidVocabularyId); DataService ds = new DataService(); //Act/Assert Assert.Throws<SqlException>(() => ds.AddSimpleTerm(term, Constants.USER_ValidId)); }
public void DataService_AddSimpleTerm_Returns_Correct_Id_On_Valid_Term() { //Arrange DataUtil.AddDatabaseObject(virtualScriptFilePath, addSimpleTerm); Term term = ContentTestHelper.CreateValidSimpleTerm(Constants.VOCABULARY_ValidVocabularyId); DataService ds = new DataService(); //Act int termItemId = ds.AddSimpleTerm(term, Constants.USER_ValidId); //Assert DatabaseAssert.RecordLastAddedIdEquals(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName, "TermID", termItemId); }