function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Harjeet SinghHarjeet Singh 

Urgent requirement for test class

Hi All,
I have an urgent requirement for test class creation.I have posted my controller code here.If possible,any one from developer community can provide me a test class code for my controller.It would be really very helpful for me as i am very new to salesforce and this is very urgent requirement needs to complete asap.
public class ControllerWrapper{

private Set<Id> selectedContactIds;

//Our collection of the class/wrapper objects 
public List<wrapSubscription> wrapSubscriptionList {get; set;}
public List<csord__Subscription__c> selectedSubscriptions{get;set;}
public Boolean isCancel{get;set;}
public string accountid;
public String selectedActions{get;set;}
public Date dat {get;set;}
public String query {get; set;}
public List<Account> accounts {get; set;}
public Id acctId {get; set;}
public String accountName {get; set;}
    
//Constructor class   
public ControllerWrapper(){
    accountid=ApexPages.currentPage().getParameters().get('id');
        if(wrapSubscriptionList == null) {
           wrapSubscriptionList= new List<wrapSubscription>();
            for(csord__Subscription__c s: [select Id, Name,csord__Status__c, csord__Account__c from csord__Subscription__c where csord__Account__c=:accountid LIMIT 20]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapSubscriptionList.add(new wrapSubscription(s));
            }
        }
    }

//function for calling dummy lookup field which is created on vf page 
public PageReference runQuery()
    {
        List<List<Account>> searchResults=[FIND :query IN ALL FIELDS RETURNING Account (id, name, billingstreet, billingcity, billingpostalcode)];
        accounts=searchResults[0];
        return null;
    }
    

//function for selection of values from dummy picklist field "Action"
public List<SelectOption> getActionsOptions() {
        List<SelectOption> actionOptions = new List<SelectOption>();
        actionOptions.add(new SelectOption('','-None-'));
        actionOptions.add(new SelectOption('Take Over','Take Over'));
        actionOptions.add(new SelectOption('Invoice Switch','Invoice Switch'));
        actionOptions.add(new SelectOption('Move','Move'));
                return actionOptions;
}
   

//Function for pagination logic
public ApexPages.StandardSetController setCon {
get {
    if(setCon == null) {
         setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
            [select Id, Name,csord__Status__c, csord__Account__c from csord__Subscription__c where csord__Account__c=:accountid ]));
                             }
                        return setCon;
                }
        set;
    }
public List<csord__Subscription__c > getWrapSubscriptionList() {
         
          setCon.setpagesize(20);
         setCon.setpageNumber(1);
         return (List<csord__Subscription__c >) setCon.getRecords();
    }


//Method for obtaining current page no.
public Integer getPageNumber(){
 
        return this.setCon.getPageNumber();
 
    }
    

 

//Function returns the total no pages 
Public Integer getTotalPages(){
 
        Decimal totalSize = this.setCon.getResultSize();
        Decimal pageSize = this.setCon.getPageSize();
 
        Decimal pages = totalSize/pageSize;
 
        return (Integer)pages.round(System.RoundingMode.CEILING);
    }             
                  

     
//Function to call Proceed button    
public void processSelected() {
    selectedSubscriptions = new List<csord__Subscription__c>();
 
        for(wrapSubscription wrapSubscriptionObj : wrapSubscriptionList) {
            if(wrapSubscriptionObj.selected == true) {
                selectedSubscriptions.add(wrapSubscriptionObj.sub);
            }
        }
    }
    
//Function to process the Cancel Button
public PageReference cancel(){
        return new PageReference('/'+accountid);
    }
    
//Method for calling Next Button
public void next(){

    if(this.setCon.getHasNext())
        this.setCon.next();

    }

//Method for calling Previous Button
public void previous(){

    if(this.setCon.getHasPrevious())
        this.setCon.previous();

    }
    
    
 
                         
 
// This is our wrapper/container class. In this example a wrapper class contains both the custom object Subscription and a Boolean value
public class wrapSubscription {
        public csord__Subscription__c sub {get; set;}
        public Boolean selected {get; set;}
 
        public wrapSubscription(csord__Subscription__c s) {
            sub = s;
            selected = false;
        }
    }
}
You people have helped me alot earlier and this time also i am very optimistic about the same.I am seeking help from last 2 days here.
This is urgent requiremnt.
Many thanks in advance.