In order to prevent delete transaction to be committed to DB, you need to [addError][1] to record, that should not be deleted

    trigger PreventAccountDelete on Account (before delete) {
    
        for(Account acc : trigger.old){
            acc.adderror('Account Cannot be deleted');
        }
    }

to test this behavior run the following unit-test

    @isTest
    private class PreventAccountDeleteTest {
    	
        @isTest
        static void testPreventAccDel(){
            Account accRecord = new Account(name='testAccount');
            insert accRecord;
            
            try{
                delete accRecord;
            }catch(DMLexception e){
                System.assert(e.getMessage().contains('Account Cannot be deleted'),'Account Cannot be deleted');                       
            }
        }
    }


  [1]: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm