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
srikanth11srikanth11 

test case help

this is the clas i have written some one help me how to write the test case

public with sharing class files1 
 {

    


    public files1() {
s1=new file__c();
 s2=new file__c();
 s3=new file__c();
 s4=new file__c();
 s4=new file__c();
 s5=new file__c();
 
    }


   
    
 public files1(ApexPages.StandardController controller) 
 
 {
 
  }
 public file__c s1 {get; set;}
 public file__c s2 {get; set;}
 public file__c s3 {get; set;}
 public file__c s4 {get; set;}
 public file__c s5 {get; set;}
 
 public PageReference saveall() {
 insert s1;
 insert s2;
 insert s3;
 insert s4;
 insert s5;
        return null;
    }
 
 
 
 
 }

 

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

You can try below code

 

Use this public with sharing class files1
{
public files1()
{
s1=new file__c();
s2=new file__c();
s3=new file__c();
s4=new file__c();
s4=new file__c();
s5=new file__c();
}
public files1(ApexPages.StandardController controller)
{

}
public file__c s1 {get; set;}
public file__c s2{get; set;}
public file__c s3{get; set;}
public file__c s4{get; set;}
public file__c s5{get; set;}
public PageReference saveall()
{
insert s1;
insert s2;
insert s3;
insert s4;
insert s5;
return null;
}
static testMethod void myTest()
{
files1 f=new files1();
f.saveall();
}

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

You can try below code

 

Use this public with sharing class files1
{
public files1()
{
s1=new file__c();
s2=new file__c();
s3=new file__c();
s4=new file__c();
s4=new file__c();
s5=new file__c();
}
public files1(ApexPages.StandardController controller)
{

}
public file__c s1 {get; set;}
public file__c s2{get; set;}
public file__c s3{get; set;}
public file__c s4{get; set;}
public file__c s5{get; set;}
public PageReference saveall()
{
insert s1;
insert s2;
insert s3;
insert s4;
insert s5;
return null;
}
static testMethod void myTest()
{
files1 f=new files1();
f.saveall();
}

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

This was selected as the best answer
srikanth11srikanth11

great help u rock jain