• NatureGod
  • NEWBIE
  • 10 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 7
    Replies
Hi all,

I have the following Trigger:
trigger SeekSerialNumberinCase on Case(before insert, before update)  {

Map<String, Case> CaseMap = new Map<String, Case>();
    for (Case Ca : System.Trigger.new) {
//        if ((Ca.Serial_Number__c != null) &&
//                (Ca.Serial_Number__c != System.Trigger.oldMap.get(Ca.Id).Serial_Number__c)) {
            if (CaseMap.containsKey(Ca.Serial_Number__c)) {
//                Ca.Serial_Number__c.addError('Another Case has the ' + 'same Serial_Number__c.');
           } else {
               CaseMap.put(Ca.Serial_Number__c, Ca);
//            }
       }
    }
    for (Case Ca : [SELECT Serial_Number__c FROM Case WHERE Serial_Number__c IN :CaseMap.KeySet()]) {
        Case newCase = CaseMap.get(Ca.Serial_Number__c);
          newCase.Rerepair__c = TRUE;
//        newCase.Serial_Number__c.addError('A Case with this Serial_Number__c ' + 'already exists.');
    }
}

Which seeks if a Serial number exists in cases.
If yes , it assigns a pic sotred in the documents.

Any suggestions for a Test class worth > 75% ?

Kind Regards,
Stefanos
Hi Team,

I have the following trigger:

trigger UpdateHoursinCase on Case(after insert, after update)

{
  Map<ID, Contract> parentCont= new Map<ID, Contract>();
  List<Id> listIds = new List<Id>();

  for (Case childObj : Trigger.new) {
    listIds.add(childObj.Contract__c);
  }

  parentCont= new Map<Id, Contract>([SELECT id, Hours__c FROM Contract WHERE ID IN :listIds]);

  for (Case Cas: Trigger.new){
     Contract myParentCont = parentCont.get(Cas.Contract__c);
     myParentCont.Hours__c +=   Cas.HoursofWork__c;
  }

  update parentCont.values();
}

which counts hours from the "Child" Case to the Parent Contract.
I works fine.
The Class is:

@istest
public class UpdateLocationStatusonLocationClass{
    Private Static testmethod void TesttrgOnArticulo(){
        Test.startTest();
        Contract  CONT = new Contract ();

        CONT.RecordTypeId  = '012D0000000kZsP';
        CONT.AccountId = '001D0000010dW4H';
//        CONT.AccountId = '001L000000KmBfF';
       
        CONT.CustomerSignedId = '003D0000017D7y8';
//        CONT.CustomerSignedId = '003L000000HQ131';
       
        CONT.Status = 'Draft';   
        String datea = '2000-11-01';
        CONT.StartDate = Date.valueOf(datea);
        CONT.ContractTerm = 9;
      
        insert CONT;
        List<Case>Lstcas=new List<Case>();
        for(integer i=0; i<5; i++){
       
            Case CAS = new Case();
            CAS.Contract__c = CONT.id;
            CAS.Location__c = 'Remote';           
            CAS.Charge__c = 'PER CALL';           
            CAS.AccountId = '001D0000010dW4H';
            CAS.ContactId = '003D0000017D7y8';           
            CONT.Status = 'Closed';
            CAS.Priority= 'EXECUTIVE';           

            Lstcas.add(CAS);
        }
        insert Lstcas;
       
        CONT.RecordTypeId  = '012D0000000kZsP';
        CONT.AccountId = '001D0000010dW4H';
        CONT.CustomerSignedId = '003D0000017D7y8';
        CONT.Status = 'Draft';    
        CONT.StartDate = Date.valueOf(datea);
        CONT.ContractTerm = 9;
       
        update CONT;
       
        Test.stopTest();
    }
}

And it gets only 71% !
Any suggestions to add 4% ?
Best Regards,
Stefanos
Hi all,

I have the following trigger:

trigger UpdateLocationStatusonLocationUsingMap on Account (before insert) {

for( Account  parent: Trigger.new)
{

List<Location__c > children = [ SELECT Id, Associate__c , Status__c from Location__c  where Associate__c  = :parent.Id];

List<Location__c > childrenToUpdate = new List<Location__c >();


for(Location__c  thischild: children )
{
   if( thischild.Status__c !=  parent.Status__c )
   {
if ( parent.Status__c ==  'Under Deactivation' ||  parent.Status__c ==  'Inactive')
{
       thischild.Status__c =  parent.Status__c ;
      childrenToUpdate.add(thischild);
}
   }
}


   update childrenToUpdate;


}

}

Which works fine and has passed 100 and works in production.
But when it comes running batch using the apex data loader and the .xml, it reaches the governing limit of 100 giving the message:

«Definitely you are using one or more soql query in a loop and hence the number of query executed in one run time is crossing the governing limit of 100 query.......The alternative is to get the values in map beforehand and use map values instead of query in loop.......»

Any suggestions on how to skip the for and introduce a map?

Best Regards,
Stefanos T.

Hi all,

 

I am posting this again,

I have built the trigger :

 

trigger UpdateLocationStatusonLocation on Account (After Update) {

for( Account parent: Trigger.new)
{

List<Location__c > children = [ SELECT Id, Associate__c , Status__c from Location__c where Associate__c = :parent.Id];

List<Location__c > childrenToUpdate = new List<Location__c >();

for(Location__c thischild: children )
{
if( thischild.Status__c != parent.Status__c )
{
thischild.Status__c = parent.Status__c ;
childrenToUpdate.add(thischild);
}
}


update childrenToUpdate;


}

}

 

Which is to update a picklist item in the child object when we change the same picklist in the parent.

This works fine and I do not see any Governance limitation.

 

I have built this test class:

 

@istest
public class UpdateLocationStatusonLocationClass{
Private Static testmethod void TesttrgOnArticulo(){
Test.startTest();
Account ACC = new Account();

ACC.Associate_s_Title__c = 'TEST';
ACC.Name = 'TEST';
ACC.Status__c = 'Under Deactivation';

insert ACC;
id idss=acc.id;

for(Integer i = 0; i < 50; i++){
Location__c LOC = new Location__c();
LOC.Associate__c = idss;
LOC.Location_Name__c = 'Test';
LOC.Status__c = 'Active';
LOC.Trade_Category__c = 'BANK';
LOC.Subzone__c = 'a0Ec000000AptpX';
LOC.Prefecture__c = 'Attica';
LOC.SubPrefecture__c = 'Central Sector of Athens';
LOC.Municipality__c = 'Athina';
LOC.Locale__c = 'Kerameikos';
LOC.Address_English__c = 'Athina';
LOC.Address__c = 'Kerameikos';
LOC.Phone_Number__c = '56897845';
insert LOC;
update LOC;
}

Test.stopTest();
// List<Location__c > children = [ SELECT Id, Associate__c , Status__c from Location__c where Associate__c = :ACC.Id];
}
}

 

But it does not get more than 75% do deploy.

 

Any Suggestions how to make it deploy, please?

 

Best Regards,

Stefanos

Hi,

 

For the following trigger:

 

trigger UpdateLocationStatusonLocation on Account (After Update) {

for( Account parent: Trigger.new)
{

List<Location__c > children = [ SELECT Id, Associate__c , Status__c from Location__c where Associate__c = :parent.Id];

List<Location__c > childrenToUpdate = new List<Location__c >();

for(Location__c thischild: children )
{
if( thischild.Status__c != parent.Status__c )
{
thischild.Status__c = parent.Status__c ;
childrenToUpdate.add(thischild);
}
}


update childrenToUpdate;


}

}

 

Which works OK in theSandbox and deals with Accounts and a custom childobject.

When we update a picklistin Accounts, it has to update the corrsponding fieldin the Child.

 

The Test Class I wrote is:

 

@istest
public class UpdateLocationStatusonLocationClass{
Private Static testmethod void TesttrgOnArticulo(){
//Insert Participacion__c Record
Account ACC = new Account();
ACC.Associate_s_Title__c = 'TEST';
ACC.Name = 'TEST';
ACC.Status__c = 'Under Deactivation';
Test.startTest();
insert ACC;

 

//Insert Articulo__c Record
for(Integer i = 0; i < 50; i++){
Location__c LOC = new Location__c();
LOC.Associate__c = '001c000000TSO7v';
LOC.Location_Name__c = 'Test';
LOC.Status__c = 'Active';
LOC.Trade_Category__c = 'BANK';
LOC.Subzone__c = 'a0Ec000000AptpX';
LOC.Prefecture__c = 'Attica';
LOC.SubPrefecture__c = 'Central Sector of Athens';
LOC.Municipality__c = 'Athina';
LOC.Locale__c = 'Kerameikos';
LOC.Address_English__c = 'Athina';
LOC.Address__c = 'Kerameikos';
LOC.Phone_Number__c = '56897845';
insert LOC;
update LOC;
}

ACC.Associate_s_Title__c = 'TEST';
ACC.Name = 'TEST';
ACC.Status__c = 'Under Deactivation';


//Insert Participacion__c Record
// ACC.Associate_s_Title__c = 'TEST';
// ACC.Name = 'TEST';
// ACC.Status__c = 'Under Deactivation';
// insert Acc ;

// LOC.Location_Name__c = 'Test';
// LOC.Status__c = 'Active';
// LOC.Trade_Category__c = 'BANK';
// LOC.Subzone__c = 'test';
// LOC.Prefecture__c = 'Attica';
// LOC.SubPrefecture__c = 'Central Sector of Athens';
// LOC.Municipality__c = 'Athina';
// LOC.Locale__c = 'Kerameikos';
// LOC.Address_English__c = 'Athina';
// LOC.Address__c = 'Kerameikos';
// LOC.Phone_Number__c = 56897845;
// update LOC;

ACC.Associate_s_Title__c = 'TEST';
ACC.Name = 'TEST';
ACC.Status__c = 'Under Deactivation';
update Acc;

Test.stopTest();
// List<Location__c > children = [ SELECT Id, Associate__c , Status__c from Location__c where Associate__c = :ACC.Id];
}
}

 

But it does not get a 75%.

 

Any suggestions to nake it deploy in the production please?

 

Best Regards.

Stefanos

Greetings,

 

I am to Simulate an edit/save on parent object, which is a custom object, Cunsumer__c from its child, a Standard, Solutions.

 

The code I wrote is:

 

trigger AutoUpdateConsumer on Solution (after insert,after update) {
List<Solution> S = [Select Solution.Consumer__c From Solution];

// String Sol = '0000000042';
id Sol = S[0].Consumer__c;

List<Consumer__c> Con = [Select Consumer__c.Name From Consumer__c where Consumer__c.Name =: Sol ];

Database.update(Con);

}

 

This works fine for Sol =  '0000000042' (in comments) but not for a dynamic, the id which is valid when we edit the specific Solution record and everyone which has the same parent Cunsumer.

 

Any Help really appreciated.

 

Stefanos

Greetings,

 

Although both Triggers got 100% coverage in the dev,, funny enough, in the prod it wil not validate since it requires as it says 100% coverage!!!

 

Trigger 1:

trigger CalculateTotalAmount on Consumer__c (before update)
{

Integer i = 0;

Consumer__c parObj = Trigger.new[i];

// Current parent opportunity ID
String intTest = Trigger.new[i].Id;

//Step 2. Create a list of opportunities who are children of this parent opportunity record.
List<Solution> opp = [Select Solution.Id, Solution.Points__c From Solution where Solution.Consumer__c =: intTest];

Double j = 0;
Double jj = 0;


// Loop through the filtered Consumers and sum up their amounts.
for(Solution op : opp)
{
If
(
op.Points__c != Null
)


{
j += op.Points__c ;
jj += op.Points__c ;

}
}
parObj.Parallel_Points__c = j;
// parObj.Points__c = jj;

}

 

Trigger 2:

trigger CalculateTotalAmountAccount on Account (before update)
{

Integer i = 0;

Account parObj = Trigger.new[i];

// Current parent opportunity ID
String intTest = Trigger.new[i].Id;

//Step 2. Create a list of Consumer__c who are children of this parent opportunity record.
List<Consumer__c> opp = [Select Consumer__c.Id, Consumer__c.Basket__c From Consumer__c where Consumer__c.Ophelia__c =: intTest];

Double j = 0;

// Loop through the filtered Consumers and sum up their amounts.
for(Consumer__c op : opp)
{
If
(
op.Basket__c != Null
)

{
j += op.Basket__c;
}
}
parObj.Basket__c = j;

Test Class:

@istest
public class TesttrgOnArticulo{
Private Static testmethod void TesttrgOnArticulo(){
//Insert Participacion__c Record
Consumer__c Con = new Consumer__c ();
Con.Mobile__c = '1234';
Test.startTest();
insert Con;

 

//Insert Articulo__c Record
for(Integer i = 0; i < 50; i++){
Solution Sol = new Solution();
Sol.SolutionName = 'Test';
Sol.Status= 'Reviewed';
Sol.PointConvertion__c = 'Προσθήκη Πόντων';
Sol.Total_Amount__c = 100;
Sol.PointConvertion__c = '10';
Sol.Consumer__c = Con.id;
Sol.Points__c = 0;
Sol.Points__c = Sol.Points__c +1;
insert Sol;
update Sol;
}

Con.Mobile__c = '5678';
update Con;



//Insert Participacion__c Record
Account Acc = new Account();
Acc.Name= 'TEST';
insert Acc ;

Con.Ophelia__c = Acc.id;
Con.Basket__c = 1000;
update Con;

Acc.Name= 'TEST Update';
update Acc;

Test.stopTest();
List<Solution> opp = [Select Solution.Id, Solution.Points__c From Solution where Solution.Consumer__c =: Con.id];
}
}

 

Any suggestions?

 

 

Stefanos

Test class only gets 66% coverage.for 2 Triggers.

 

Greetings,

I have written (Enterprise Edition ) 2 Triggers:

1 for a custom object which sums points from the Standard Soltution to  a custom object:

--------------------------

trigger CalculateTotalAmount on Consumer__c (before update)
{

Integer i = 0;

Consumer__c parObj = Trigger.new[i];

// Current parent opportunity ID
String intTest = Trigger.new[i].Id;

//Step 2. Create a list of opportunities who are children of this parent opportunity record.
List<Solution> opp = [Select Solution.Id, Solution.Points__c From Solution where Solution.Consumer__c =: intTest];

Double j = 0;
Double jj = 0;


// Loop through the filtered Consumers and sum up their amounts.
for(Solution op : opp)
{
If
(
op.Points__c != Null
)


{
j += op.Points__c ;
jj += op.Points__c ;

}
}
parObj.Parallel_Points__c = j;
// parObj.Points__c = jj;

}

--------------------------------------------

2nd Trigger , Similar, this time standard is the Accounts:

 

trigger CalculateTotalAmountAccount on Account (before update)
{

Integer i = 0;

Account parObj = Trigger.new[i];

// Current parent opportunity ID
String intTest = Trigger.new[i].Id;

//Step 2. Create a list of Consumer__c who are children of this parent opportunity record.
List<Consumer__c> opp = [Select Consumer__c.Id, Consumer__c.Basket__c From Consumer__c where Consumer__c.Ophelia__c =: intTest];

Double j = 0;

// Loop through the filtered Consumers and sum up their amounts.
for(Consumer__c op : opp)
{
If
(
op.Basket__c != Null
)

{
j += op.Basket__c;
}
}
parObj.Basket__c = j;

}

------------------------------

Both Triggers work fine.

 

I have written the following Test Class for both which only gets 66%:

@istest
public class TesttrgOnArticulo{
Private Static testmethod void TesttrgOnArticulo(){

//Insert Participacion__c Record
Consumer__c Con = new Consumer__c ();
Con.Mobile__c = '1234';
Test.startTest();
insert Con;

Con.Mobile__c = '5678';
update Con;

//Insert Articulo__c Record
for(Integer i = 0; i < 50; i++){

Solution Sol = new Solution();
Sol.SolutionName = 'Test';
Sol.Status= 'Reviewed';
Sol.PointConvertion__c = 'Προσθήκη Πόντων';
Sol.Total_Amount__c = 100;
Sol.PointConvertion__c = '10';
Sol.Consumer__c = Con.id;
Sol.Points__c = 0;
Sol.Points__c = Sol.Points__c +1;
insert Sol;
update Sol;

}

//Insert Participacion__c Record
Account Acc = new Account();
Acc.Name= 'TEST';
insert Acc ;

Test.stopTest();


List<Solution> opp = [Select Solution.Id, Solution.Points__c From Solution where Solution.Consumer__c =: Con.id];

}
}

----------------------------------------------

 

 

Any Help to get at least 75% would  be Appreciated.

Many Thanks,

Stefanos

Hi Team,

I have the following trigger:

trigger UpdateHoursinCase on Case(after insert, after update)

{
  Map<ID, Contract> parentCont= new Map<ID, Contract>();
  List<Id> listIds = new List<Id>();

  for (Case childObj : Trigger.new) {
    listIds.add(childObj.Contract__c);
  }

  parentCont= new Map<Id, Contract>([SELECT id, Hours__c FROM Contract WHERE ID IN :listIds]);

  for (Case Cas: Trigger.new){
     Contract myParentCont = parentCont.get(Cas.Contract__c);
     myParentCont.Hours__c +=   Cas.HoursofWork__c;
  }

  update parentCont.values();
}

which counts hours from the "Child" Case to the Parent Contract.
I works fine.
The Class is:

@istest
public class UpdateLocationStatusonLocationClass{
    Private Static testmethod void TesttrgOnArticulo(){
        Test.startTest();
        Contract  CONT = new Contract ();

        CONT.RecordTypeId  = '012D0000000kZsP';
        CONT.AccountId = '001D0000010dW4H';
//        CONT.AccountId = '001L000000KmBfF';
       
        CONT.CustomerSignedId = '003D0000017D7y8';
//        CONT.CustomerSignedId = '003L000000HQ131';
       
        CONT.Status = 'Draft';   
        String datea = '2000-11-01';
        CONT.StartDate = Date.valueOf(datea);
        CONT.ContractTerm = 9;
      
        insert CONT;
        List<Case>Lstcas=new List<Case>();
        for(integer i=0; i<5; i++){
       
            Case CAS = new Case();
            CAS.Contract__c = CONT.id;
            CAS.Location__c = 'Remote';           
            CAS.Charge__c = 'PER CALL';           
            CAS.AccountId = '001D0000010dW4H';
            CAS.ContactId = '003D0000017D7y8';           
            CONT.Status = 'Closed';
            CAS.Priority= 'EXECUTIVE';           

            Lstcas.add(CAS);
        }
        insert Lstcas;
       
        CONT.RecordTypeId  = '012D0000000kZsP';
        CONT.AccountId = '001D0000010dW4H';
        CONT.CustomerSignedId = '003D0000017D7y8';
        CONT.Status = 'Draft';    
        CONT.StartDate = Date.valueOf(datea);
        CONT.ContractTerm = 9;
       
        update CONT;
       
        Test.stopTest();
    }
}

And it gets only 71% !
Any suggestions to add 4% ?
Best Regards,
Stefanos

Hi,

 

For the following trigger:

 

trigger UpdateLocationStatusonLocation on Account (After Update) {

for( Account parent: Trigger.new)
{

List<Location__c > children = [ SELECT Id, Associate__c , Status__c from Location__c where Associate__c = :parent.Id];

List<Location__c > childrenToUpdate = new List<Location__c >();

for(Location__c thischild: children )
{
if( thischild.Status__c != parent.Status__c )
{
thischild.Status__c = parent.Status__c ;
childrenToUpdate.add(thischild);
}
}


update childrenToUpdate;


}

}

 

Which works OK in theSandbox and deals with Accounts and a custom childobject.

When we update a picklistin Accounts, it has to update the corrsponding fieldin the Child.

 

The Test Class I wrote is:

 

@istest
public class UpdateLocationStatusonLocationClass{
Private Static testmethod void TesttrgOnArticulo(){
//Insert Participacion__c Record
Account ACC = new Account();
ACC.Associate_s_Title__c = 'TEST';
ACC.Name = 'TEST';
ACC.Status__c = 'Under Deactivation';
Test.startTest();
insert ACC;

 

//Insert Articulo__c Record
for(Integer i = 0; i < 50; i++){
Location__c LOC = new Location__c();
LOC.Associate__c = '001c000000TSO7v';
LOC.Location_Name__c = 'Test';
LOC.Status__c = 'Active';
LOC.Trade_Category__c = 'BANK';
LOC.Subzone__c = 'a0Ec000000AptpX';
LOC.Prefecture__c = 'Attica';
LOC.SubPrefecture__c = 'Central Sector of Athens';
LOC.Municipality__c = 'Athina';
LOC.Locale__c = 'Kerameikos';
LOC.Address_English__c = 'Athina';
LOC.Address__c = 'Kerameikos';
LOC.Phone_Number__c = '56897845';
insert LOC;
update LOC;
}

ACC.Associate_s_Title__c = 'TEST';
ACC.Name = 'TEST';
ACC.Status__c = 'Under Deactivation';


//Insert Participacion__c Record
// ACC.Associate_s_Title__c = 'TEST';
// ACC.Name = 'TEST';
// ACC.Status__c = 'Under Deactivation';
// insert Acc ;

// LOC.Location_Name__c = 'Test';
// LOC.Status__c = 'Active';
// LOC.Trade_Category__c = 'BANK';
// LOC.Subzone__c = 'test';
// LOC.Prefecture__c = 'Attica';
// LOC.SubPrefecture__c = 'Central Sector of Athens';
// LOC.Municipality__c = 'Athina';
// LOC.Locale__c = 'Kerameikos';
// LOC.Address_English__c = 'Athina';
// LOC.Address__c = 'Kerameikos';
// LOC.Phone_Number__c = 56897845;
// update LOC;

ACC.Associate_s_Title__c = 'TEST';
ACC.Name = 'TEST';
ACC.Status__c = 'Under Deactivation';
update Acc;

Test.stopTest();
// List<Location__c > children = [ SELECT Id, Associate__c , Status__c from Location__c where Associate__c = :ACC.Id];
}
}

 

But it does not get a 75%.

 

Any suggestions to nake it deploy in the production please?

 

Best Regards.

Stefanos

Greetings,

 

I am to Simulate an edit/save on parent object, which is a custom object, Cunsumer__c from its child, a Standard, Solutions.

 

The code I wrote is:

 

trigger AutoUpdateConsumer on Solution (after insert,after update) {
List<Solution> S = [Select Solution.Consumer__c From Solution];

// String Sol = '0000000042';
id Sol = S[0].Consumer__c;

List<Consumer__c> Con = [Select Consumer__c.Name From Consumer__c where Consumer__c.Name =: Sol ];

Database.update(Con);

}

 

This works fine for Sol =  '0000000042' (in comments) but not for a dynamic, the id which is valid when we edit the specific Solution record and everyone which has the same parent Cunsumer.

 

Any Help really appreciated.

 

Stefanos

Test class only gets 66% coverage.for 2 Triggers.

 

Greetings,

I have written (Enterprise Edition ) 2 Triggers:

1 for a custom object which sums points from the Standard Soltution to  a custom object:

--------------------------

trigger CalculateTotalAmount on Consumer__c (before update)
{

Integer i = 0;

Consumer__c parObj = Trigger.new[i];

// Current parent opportunity ID
String intTest = Trigger.new[i].Id;

//Step 2. Create a list of opportunities who are children of this parent opportunity record.
List<Solution> opp = [Select Solution.Id, Solution.Points__c From Solution where Solution.Consumer__c =: intTest];

Double j = 0;
Double jj = 0;


// Loop through the filtered Consumers and sum up their amounts.
for(Solution op : opp)
{
If
(
op.Points__c != Null
)


{
j += op.Points__c ;
jj += op.Points__c ;

}
}
parObj.Parallel_Points__c = j;
// parObj.Points__c = jj;

}

--------------------------------------------

2nd Trigger , Similar, this time standard is the Accounts:

 

trigger CalculateTotalAmountAccount on Account (before update)
{

Integer i = 0;

Account parObj = Trigger.new[i];

// Current parent opportunity ID
String intTest = Trigger.new[i].Id;

//Step 2. Create a list of Consumer__c who are children of this parent opportunity record.
List<Consumer__c> opp = [Select Consumer__c.Id, Consumer__c.Basket__c From Consumer__c where Consumer__c.Ophelia__c =: intTest];

Double j = 0;

// Loop through the filtered Consumers and sum up their amounts.
for(Consumer__c op : opp)
{
If
(
op.Basket__c != Null
)

{
j += op.Basket__c;
}
}
parObj.Basket__c = j;

}

------------------------------

Both Triggers work fine.

 

I have written the following Test Class for both which only gets 66%:

@istest
public class TesttrgOnArticulo{
Private Static testmethod void TesttrgOnArticulo(){

//Insert Participacion__c Record
Consumer__c Con = new Consumer__c ();
Con.Mobile__c = '1234';
Test.startTest();
insert Con;

Con.Mobile__c = '5678';
update Con;

//Insert Articulo__c Record
for(Integer i = 0; i < 50; i++){

Solution Sol = new Solution();
Sol.SolutionName = 'Test';
Sol.Status= 'Reviewed';
Sol.PointConvertion__c = 'Προσθήκη Πόντων';
Sol.Total_Amount__c = 100;
Sol.PointConvertion__c = '10';
Sol.Consumer__c = Con.id;
Sol.Points__c = 0;
Sol.Points__c = Sol.Points__c +1;
insert Sol;
update Sol;

}

//Insert Participacion__c Record
Account Acc = new Account();
Acc.Name= 'TEST';
insert Acc ;

Test.stopTest();


List<Solution> opp = [Select Solution.Id, Solution.Points__c From Solution where Solution.Consumer__c =: Con.id];

}
}

----------------------------------------------

 

 

Any Help to get at least 75% would  be Appreciated.

Many Thanks,

Stefanos