public void DataService_DeleteScopeType_Should_Do_Nothing_On_InValid_ScopeType() { //Arrange int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.ScopeTypesTableName); DataUtil.AddDatabaseObject(virtualScriptFilePath, deleteScopeType); ScopeType scopeType = ContentTestHelper.CreateValidScopeType(); scopeType.ScopeTypeId = Constants.SCOPETYPE_InValidScopeTypeId; DataService ds = new DataService(); //Act ds.DeleteScopeType(scopeType); //Assert DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.ScopeTypesTableName, rowCount); }
public void DataService_DeleteScopeType_Delete_Record_On_Valid_ScopeType() { //Arrange int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.ScopeTypesTableName); DataUtil.AddDatabaseObject(virtualScriptFilePath, deleteScopeType); ScopeType scopeType = ContentTestHelper.CreateValidScopeType(); scopeType.ScopeTypeId = Constants.SCOPETYPE_ValidScopeTypeId; DataService ds = new DataService(); //Act ds.DeleteScopeType(scopeType); //Assert using (SqlConnection connection = new SqlConnection(DataTestHelper.ConnectionString)) { connection.Open(); DatabaseAssert.RecordCountIsEqual(connection, ContentDataTestHelper.ScopeTypesTableName, rowCount - 1); DatabaseAssert.RecordDoesNotExist(connection, ContentDataTestHelper.ScopeTypesTableName, keyField, Constants.SCOPETYPE_ValidScopeTypeId.ToString()); } }