liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@isTest
public with sharing class StartTradingController2Test {
    public static String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
    public static String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
    public static String leadNR = Schema.SObjectType.Lead.getRecordTypeInfosByDeveloperName().get('NewDaily_Report').getRecordTypeId();
    public static String rectAg = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
    public static User thisUser = [ SELECT Id from User WHERE Id = :UserInfo.getUserId()];
    @testSetup 
    static void testSetup() {
        System.runAs(thisUser){
            Account testRectcoAccounts = new Account(Name = 'testRectcoAccount', RecordTypeId = rectHp);
            insert testRectcoAccounts;
            Account testRectHpAccounts = new Account(Name = 'testRectHpAccount', RecordTypeId = rectCo, Hospital__c = testRectcoAccounts.id);
            insert testRectHpAccounts;
            Contact testContacts = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber',RecordTypeId = rectAg,  AWS_Data_Id__c = 'TestContact', accountId = testRectHpAccounts.id);
            insert testContacts;
            Lead testLeads = new Lead(LastName='testLead', Company='testLead',RecordTypeId = leadNR, Hospital_Name__c = testRectHpAccounts.id, Contact_Name__c = testContacts.Id);
            insert testLeads;
        }
    }
    static testMethod void test1() {
 
 
        Lead lea = [SELECT Id FROM Lead WHERE RecordTypeId =:leadNR LIMIT 1];
 
        StartTradingController2.init(lea.Id);
        StartTradingController2.start(lea.Id);
        
        // StartTradingController2.start('00Q1000000GC9TqEAL');
    }
}