public void DataService_DeleteContentType_Should_Do_Nothing_On_InValid_ContentType() { //Arrange int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.ContentTypesTableName); DataUtil.AddDatabaseObject(virtualScriptFilePath, deleteContentType); ContentType contentType = ContentTestHelper.CreateValidContentType(); contentType.ContentTypeId = Constants.CONTENTTYPE_InValidContentTypeId; DataService ds = new DataService(); //Act ds.DeleteContentType(contentType); //Assert DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.ContentTypesTableName, rowCount); }
public void DataService_DeleteContentType_Delete_Record_On_Valid_ContentType() { //Arrange int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.ContentTypesTableName); DataUtil.AddDatabaseObject(virtualScriptFilePath, deleteContentType); ContentType contentType = ContentTestHelper.CreateValidContentType(); contentType.ContentTypeId = Constants.CONTENTTYPE_ValidContentTypeId; DataService ds = new DataService(); //Act ds.DeleteContentType(contentType); //Assert using (SqlConnection connection = new SqlConnection(DataTestHelper.ConnectionString)) { connection.Open(); DatabaseAssert.RecordCountIsEqual(connection, ContentDataTestHelper.ContentTypesTableName, rowCount - 1); DatabaseAssert.RecordDoesNotExist(connection, ContentDataTestHelper.ContentTypesTableName, keyField, Constants.CONTENTTYPE_ValidContentTypeId.ToString()); } }