• Amit Trivedi 15
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
@isTest(SeeAllData = true)

public class SurveyResponseTest
{
   public static testMethod void surRes()
   {
        Account acc1 = TestDataGenerator.createAccount('Acme');
        insert acc1;
        Opportunity opp1 = TestDataGenerator.createOpportunity('TM',acc1,Date.today(),'Closed Won');
        insert opp1;
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; 
        User u = new User(Alias = 'standt', Email='A.trivedi@demoorg.com', 
        EmailEncodingKey='UTF-8', LastName='devindrop', LanguageLocaleKey='en_US', 
        LocaleSidKey='en_US', ProfileId = p.Id, 
        TimeZoneSidKey='America/Los_Angeles', UserName='KFCempress31@Nagpurorg.com');
        insert u;
        System.runAs(u)
        {
            System.debug('Current User: ' + UserInfo.getUserName());
            System.debug('Current Profile: ' + UserInfo.getProfileId()); 
        }
      Survey__c sur1 = TestDataGenerator.createSurvey('Test','For testing',Date.today(),opp1);
      insert sur1;
      Question__c que1 = TestDataGenerator.createQuestion('Who',false,'Test','Test','Test','Test','Test','Test','Test','Test','Test','Test','Test','Radio',sur1);
      insert que1;
       Feedback__c fb1 = TestDataGenerator.createFedback('Ans',que1,'Test','Test','Test','Test','Test','Test','Test','Test','Test','Test',u);
       insert fb1;
        Test.startTest();
       
    
      
        ApexPages.CurrentPage().getparameters().put('id', sur1.id);
        ApexPages.StandardController controller = new  ApexPages.StandardController(sur1);
        SurveyResponse sr = new SurveyResponse(controller);
       
        sr.radio = true;
       
        sr.radiomethod();
        sr.Submitsurvey();
        Test.stopTest();
   }
}
@isTest(SeeAllData = true)

public class SurveyResponseTest
{
   public static testMethod void surRes()
   {
        Account acc1 = TestDataGenerator.createAccount('Acme');
        insert acc1;
        Opportunity opp1 = TestDataGenerator.createOpportunity('TM',acc1,Date.today(),'Closed Won');
        insert opp1;
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; 
        User u = new User(Alias = 'standt', Email='A.trivedi@demoorg.com', 
        EmailEncodingKey='UTF-8', LastName='devindrop', LanguageLocaleKey='en_US', 
        LocaleSidKey='en_US', ProfileId = p.Id, 
        TimeZoneSidKey='America/Los_Angeles', UserName='KFCempress31@Nagpurorg.com');
        insert u;
        System.runAs(u)
        {
            System.debug('Current User: ' + UserInfo.getUserName());
            System.debug('Current Profile: ' + UserInfo.getProfileId()); 
        }
      Survey__c sur1 = TestDataGenerator.createSurvey('Test','For testing',Date.today(),opp1);
      insert sur1;
      Question__c que1 = TestDataGenerator.createQuestion('Who',false,'Test','Test','Test','Test','Test','Test','Test','Test','Test','Test','Test','Radio',sur1);
      insert que1;
       Feedback__c fb1 = TestDataGenerator.createFedback('Ans',que1,'Test','Test','Test','Test','Test','Test','Test','Test','Test','Test',u);
       insert fb1;
        Test.startTest();
       
    
      
        ApexPages.CurrentPage().getparameters().put('id', sur1.id);
        ApexPages.StandardController controller = new  ApexPages.StandardController(sur1);
        SurveyResponse sr = new SurveyResponse(controller);
       
        sr.radio = true;
       
        sr.radiomethod();
        sr.Submitsurvey();
        Test.stopTest();
   }
}