EventSpotter Class Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

Contains methods to generate (mocked) sample data for a Content Studio synchronous event handler and activate your handler implementation so it can be tested and debugged outside of Content Studio. Unlike more sophisticated mockers this implementation does not let you control the exact content of the data sent to the event handler by Content Studio.
Inheritance Hierarchy

SystemObject
  ContentStudio.EventActions.SynchronousEventHandlers.SpotlijsterEventSpotter

Namespace: ContentStudio.EventActions.SynchronousEventHandlers.Spotlijster
Assembly: EventHandlers.Spotlijster (in EventHandlers.Spotlijster.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public sealed class EventSpotter

The EventSpotter type exposes the following members.

Constructors

  NameDescription
Public methodEventSpotter
Initializes a new instance of the EventSpotter class
Top
Methods

  NameDescription
Public methodActivateWithEptdocumentTEventHandler(TEventHandler, String, String)
Activates a Content Studio version 5.2 and earlier synchronous event handler with sample data generated for an ept document and the TEventHandler type of event handler. This handler must implement the ICSEventHandler and ISingleSynchronousHandler interfaces.
Public methodActivateWithEptdocumentTEventHandler(TEventHandler, Int32, String, String)
Activates a Content Studio version 5.2 and earlier synchronous event handler with sample data generated for an ept document and the TEventHandler type of event handler.
Public methodActivateWithEptdocumentTEventHandler(TEventHandler, String, String, String)
Activates a Content Studio version 5.2 and earlier synchronous event handler with sample data generated for an ept document and the TEventHandler type of event handler.
Public methodActivateWithEptdocument2TEventHandler(TEventHandler, String, String)
Activates a Content Studio version 5.3 and later synchronous event handler with sample data generated for an ept document and the TEventHandler type of event handler. This handler must implement the ICSEventHandler2 and ISingleSynchronousHandler interfaces.
Public methodActivateWithEptdocument2TEventHandler(TEventHandler, Int32, String, String)
Activates a Content Studio version 5.3 and later synchronous event handler with sample data generated for an ept document and the TEventHandler type of event handler.
Public methodActivateWithEptdocument2TEventHandler(TEventHandler, String, String, String)
Activates a Content Studio version 5.3 and later synchronous event handler with sample data generated for an ept document and the TEventHandler type of event handler.
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)
Top
Fields

  NameDescription
Public fieldStatic memberEptDocumentTypeValue
Represents the numeric value of a Content Studio ept document type.
Top
Examples

This sample shows a very simple test project that invokes an event handler with Asserts.

C#
using System;
using ContentStudio.EventActions.SynchronousEventHandlers;
using ContentStudio.EventActions.SynchronousEventHandlers.Spotlijster;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TestOfSyncHandlers
{
    //This represents the event handler you would like to test
    public class OnBeforeDocumentSaveImpl : BeforeDocumentSaveSyncHandler
    {
        protected override void DoWork()
        {
            //Your code goes here
        }

        //If your event handler needs some clean up, it should be done
        //in the overridable Dispose method.
        protected override void Dispose(bool disposing)
        {  
            //Your cleanup code goes here
            base.Dispose(disposing);
        }  
    }

    //Code for testing an event handler outside of Content Studio
    [TestClass]
    public class TestMethods
    {
        [TestMethod]
        public void TestBeforeDocumentSave()
        {
            using (var handler = new BeforeDocumentSaveImpl())
            {
                var activator = new EventSpotter();
                //Activate the event handler, this will call your implementation
                //with mocked data so the handler can be tested and debugged.
                activator.ActivateWithEptdocument2(handler, "OnBeforeDocumentSave", null, null);

                //Do some asserts
                Assert.IsFalse(String.IsNullOrEmpty(handler.Content as string));
                Assert.IsNotNull(handler.EptContent);
                Assert.IsTrue(handler.EptContent.Count > 0);
            }
        }
    }
}
See Also

Reference