I need to create a unit test that will use the following pipeline


It then needs to see if the tracking is enabled and then check if a cookie exists.

I saw some code that could help me get started but I am new to pipeline unit tests for Sitecore so I am a little confused what I need to do to make it work.

I am using xunit and Sitecore.FakeDB for Sitecore version: 8.2.

Thanks in advance.

public void ProcessTest()
    var args = new Sitecore.Pipelines.PipelineArgs();

    using (Sitecore.FakeDb.Db db = new Sitecore.FakeDb.Db())
        // register a processor mock in the Pipeline Watcher
        var processor = Substitute.For<Sitecore.FakeDb.Pipelines.IPipelineProcessor>();
        db.PipelineWatcher.Register("mypipeline", processor);

        // call the pipeline
        Sitecore.Pipelines.CorePipeline.Run("mypipeline", args);

        // check the mocked processor is called

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.