public static TrackingParticipant GetInstance(TrackingParticipantType type, ParticipantAssociation association)
        {
            switch (type)
            {
            case TrackingParticipantType.InMemoryTrackingParticipant:
                return(new InMemoryTrackingParticipant());

            //case TrackingParticipantType.SqlTrackingParticipant:
            //    if (association == ParticipantAssociation.WorkflowExtention)
            //    {
            //        TrackingParticipant trackingParticipant = new SqlTrackingParticipant();
            //        trackingParticipant.TrackingProfile = new TrackingProfile();
            //        return trackingParticipant;
            //    }
            //    else
            //    {
            //        return null;
            //            //new CustomSqlTrackingParticipant();
            //    }
            case TrackingParticipantType.CustomTrackingParticipant1WithException:
            case TrackingParticipantType.CustomTrackingParticipant2WithException:
                return(new TrackingParticipantWithException());

            case TrackingParticipantType.CustomTrackingParticipantWithDelay:
                return(new TrackingParticipantWithDelay());

            case TrackingParticipantType.StateMachineTrackingParticipant:
                return(new StateMachineTrackingParticipant());
            }
            //default.
            return(new InMemoryTrackingParticipant());
        }
Exemplo n.º 2
0
        public static void ValidateTracking(ExpectedTrace expectedTrace, ActualTrace actualTrace, TrackingProfile profile, TestProfileType profileType, TrackingParticipantType participantType)
        {
            //1. Filter the expected trace against the workFlow profile
            ExpectedTrace filteredExpectedTrace = TrackingFilter.ApplyTrackingProfile(expectedTrace, profile);

            ////2. Delete not supported trace steps by testObjects.
            ActualTrace modifiedActualTrace = TrackingFilter.DeleteNotSupportedTraceSteps(actualTrace);

            TestTraceManager.OptionalLogTrace("[TestTrackingDataManager]*****ValidateTracking()");
            ////3. Validate the expected & the actual trace
            TestTraceManager.OptionalLogTrace("[TestTrackingDataManager]Profile = {0}", profile);
            TestTraceManager.OptionalLogTrace("[TestTrackingDataManager]Actual Trace = {0}", actualTrace);
            TestTraceManager.OptionalLogTrace("[TestTrackingDataManager]Expected Trace = {0}", expectedTrace);
            TestTraceManager.OptionalLogTrace("[TestTrackingDataManager]Filtered Expected Trace (after applying tracking profile) = {0}", filteredExpectedTrace);
            TestTraceManager.OptionalLogTrace("[TestTrackingDataManager]Modified ActualTrace Trace = {0}", modifiedActualTrace);
            TestTraceManager.OptionalLogTrace("[TestTrackingDataManager]Invoking internally the trace validation...");

            ////if (!(TestProfileProvider.IsAllOrNullProfile(profileType) &&
            if (((participantType != TrackingParticipantType.SqlTrackingParticipant) &&
                 (participantType != TrackingParticipantType.ETWTrackingParticipant)))
            {
                modifiedActualTrace.Validate(filteredExpectedTrace, TestTraceManager.IsDefaultTrackingConfiguration);
            }

            //Log.TraceInternal("[TestTrackingDataManager]*****Validate method Succeeded...");
        }
 /// <summary>
 /// To make the default Sql tracking participant work for all test cases going forward, we implement it as follows:
 /// When the tracking participant needs to be added to the workflow, the OOB SqlTrackingParticipant get invoked.
 /// For verification purposes, the custom sql tracking participant is instantiated & the corresponding methods invoked.
 /// </summary>
 public static TestTrackingParticipantBase GetInstanceForVerification(TrackingParticipantType type)
 {
     return((TestTrackingParticipantBase)TestTrackingParticipantBase.GetInstance(type, ParticipantAssociation.TestVerification));
 }