I have 3 objects Master Contact, Master Volunteer\_Project\_\_c and Detail Participation\_\_c. Means Participation\_\_c is detail for both Master.
Now One Volunteer\_Project\_\_c can have many Participation\_\_c. Participation\_\_c has a field called Volunteer\_Email\_\_c which is formula field and it is fetching the it's contact's email.
Now My task is to count Number of Participation\_\_c worked for each Volunteer\_Project\_\_c and I am counting unique email addresses (Volunteer\_Email\_\_c) for it.
I can't do it with Roll-up summary field so I wrote a trigger and test cases but need a help with test cases.

Trigger: WORKS FINE!
--------------------

```
    Trigger UniqueEmailCount On Volunteer_Project__c(before insert, before update)
{
    List<Participation__c> ParticipationList = new List<Participation__c>();
    Set<String> uniqueEmails = new Set<String>();

    ParticipationList = [SELECT Volunteer_Email__c FROM Participation__c where Volunteer_Project_Name__c IN :Trigger.New];

        for (Integer i = 0; i< ParticipationList.size(); i++)
        {
            uniqueEmails.add(ParticipationList[i].Volunteer_Email__c);

        }

        for(Volunteer_Project__c proj: Trigger.new)
        {
            proj.Total_Associated_Volunteers__c = uniqueEmails.size();
        }
}

```

---

Test Cases: (NOT GETTING ANY COVERAGE) 

```
  @isTest (seeAllData=true) 
Public class UniqueEmailCount_Test{
    Public Static TestMethod Void TestingUniqueEmailCount()
    {

        Set<String> uniqueEmails = new Set<String>();
        List<Participation__c> partiList = new List<Participation__c >();
        List<Volunteer_Project__c> Vprojects = new List<Volunteer_Project__c >();
        List<Contact> Cons = New List<Contact>();

        for(Integer L = 0; L < 200 ; L++){
        Contact C = New Contact(FirstName = 'John', LastName = 'Doe' + L, Email = 'John.Doe@gmail.com' + L);

        Cons.add(C);
        }
        insert Cons; // In here  we have 200 contacts created with Email address

        for(Integer I = 0; I < 200; I++)
        {
            Participation__c Parti = New Participation__c (Volunteer_Name__c = 'John Doe' + i, Volunteer_Project_Name__c = 'Project:' + i
                                                , Devoted_Hours__c = 1);   
            insert Parti; // Here is we inserted the Parti so I think at this point we have Volunteer_Email__C populated.
            partiList.add(Parti);

        }
        insert partiList; // In here we have 200 participant created with Volunteer_Email__C I guess.

        for (Integer k = 0; k< partiList.size(); k++)
        {
            uniqueEmails.add(partiList[k].Volunteer_Email__c);
        }
        for(Integer M = 0; M < 200; M++){
        Volunteer_Project__c vp = New Volunteer_Project__c(Name = 'Project: ' + M, Total_Associated_Volunteers__c = uniqueEmails.Size());
        Vprojects.add(vp);

        }
        insert Vprojects; // In here we have 200 volunteer projects creted.

        for(Volunteer_Project__c V: Vprojects)
        {
            System.assertEquals('V.Total_Associated_Volunteers__c', 'uniqueEmails.size()');

        }

    }

}

```