protected void ConstructNonSerializableMembers()
        {
            this.sendEventsToHostTrigger = new SendMssEventsToHostTrigger();
            this.paramMsgHandler         = new ParameterMsgHandler();
            this.dryMssEventHandler      = new DryMssEventHandler();

            this._dryMssEventRelay = new DryMssEventRelay();
            this._wetMssEventRelay = new WetMssEventRelay();
            this._hostInfoRelay    = new HostInfoRelay();

            this.mssEventGenrator        = new MssEventGenerator();
            this._mssParameters          = new MssParameters();
            this.msgEntryMetadataFactory = new Factory_MssMsgRangeEntryMetadata();
            this.msgInfoFactory          = new Factory_MssMsgInfo();
            this.transformPresetMgr      = new TransformPresetMgr();
            this.eventLogger             = new EventLogger();
        }
        public void Init()
        {
            this.msgProcessorMock = new Mock <IMssMsgProcessor>();
            this.msgProcessorMock.Setup(processor => processor.ProcessMssMsg(It.IsAny <MssMsg>()))
            .Returns((MssMsg msg) => ProcessMssMsg_CopyData3(msg));
            IocMgr.Kernel.Rebind <IMssMsgProcessor>().ToConstant(msgProcessorMock.Object);

            this.mssParameterViewerMock = new Mock <IMssParameterViewer>();

            this.hostInfoRelayMock = new Mock <IHostInfoRelay>();

            //Link host info member variables to hostInfoRelayMock
            this.hostInfoRelayMock.Setup(relay => relay.SampleRate)
            .Returns(() => this.host_SampleRate);
            this.hostInfoRelayMock.Setup(relay => relay.SampleRateIsInitialized)
            .Returns(() => this.host_SampleRateIsInitialized);

            this.hostInfoRelayMock.Setup(relay => relay.Tempo)
            .Returns(() => this.host_Tempo);
            this.hostInfoRelayMock.Setup(relay => relay.TempoIsInitialized)
            .Returns(() => this.host_TempoIsInitialized);

            this.hostInfoRelayMock.Setup(relay => relay.TimeSignatureNumerator)
            .Returns(() => this.host_TimeSignatureNumerator);
            this.hostInfoRelayMock.Setup(relay => relay.TimeSignatureDenominator)
            .Returns(() => this.host_TimeSignatureDenominator);
            this.hostInfoRelayMock.Setup(relay => relay.TimeSignatureIsInitialized)
            .Returns(() => this.host_TimeSignatureIsInitialized);

            this.hostInfoRelayMock.Setup(relay => relay.CalculatedBarZeroSampleTime)
            .Returns(() => this.host_CalculatedBarZeroSampleTime);
            this.hostInfoRelayMock.Setup(relay => relay.CalculatedBarZeroIsInitialized)
            .Returns(() => this.host_CalculatedBarZeroIsInitialized);

            this.hostInfoRelayMock.Setup(relay => relay.TransportPlaying)
            .Returns(() => this.host_TransportPlaying);
            this.hostInfoRelayMock.Setup(relay => relay.TransportPlayingIsInitialized)
            .Returns(() => this.host_TransportPlayingIsInitialized);

            this.hostInfoRelayMock.Setup(relay => relay.BarPosIsInitialized)
            .Returns(() => this.host_BarPosIsInitialized);

            InitializeHostInfo_Defaults();

            this.hostInfoRelayMock.Setup(relay => relay.GetBarPosAtSampleTime(It.IsAny <long>()))
            .Returns((long sampleTime) => GetBarPosAtSampleTime_IncrementByOneQuarter(sampleTime));

            this.dryEventRelayMock = new Mock <IDryMssEventRelay>();

            //Setup ReceiveDryMssEvent() so that it adds all received events to generatedEvents.
            this.dryEventRelayMock.Setup(relay => relay.ReceiveDryMssEvent(It.IsAny <MssEvent>()))
            .Callback((MssEvent mssEvent) => generatedEventList.Add(mssEvent));

            this.wetEventRelayMock = new Mock <IWetMssEventRelay>();


            this.genMappingMgrMock = new Mock <IGeneratorMappingManager>();

            //Link up genMappingMgrMock with genMappingEntryList;
            this.genMappingMgrMock.Setup(mgr => mgr.GetNumEntries()).Returns(() => this.genMappingEntryList.Count);
            //TODO: this should really return a deep copy of genMappingEntryList instead of a shallow copy
            this.genMappingMgrMock.Setup(mgr => mgr.GetCopyOfMappingEntryList()).Returns(() => new List <IGeneratorMappingEntry>(this.genMappingEntryList));

            this.genMappingMgrMock.Setup(mgr => mgr.GetEntryIdList()).Returns(() => this.genMappingEntryList.Select(mappingEntry => mappingEntry.Id).ToList());

            this.genMappingMgrMock.Setup(mgr => mgr.GetCopyOfMappingEntryById(It.IsAny <int>())).Returns((int id) =>
            {
                var matchingEntry = this.genMappingEntryList.Find(mappingEntry => mappingEntry.Id == id);
                if (matchingEntry == null)
                {
                    return(new ReturnStatus <IGeneratorMappingEntry>());
                }
                else
                {
                    return(new ReturnStatus <IGeneratorMappingEntry>(matchingEntry));
                }
            });

            this.genMappingMgrMock
            .Setup(mgr => mgr.RunFuncOnMappingEntry(It.IsAny <int>(), It.IsAny <MappingEntryAccessor <IGeneratorMappingEntry> >()))
            .Returns((int id, MappingEntryAccessor <IGeneratorMappingEntry> entryAccessor) => {
                var matchingEntry = this.genMappingEntryList.Find(mappingEntry => mappingEntry.Id == id);
                if (matchingEntry == null)
                {
                    return(false);
                }
                else
                {
                    entryAccessor(matchingEntry);
                    return(true);
                }
            });

            eventGenerator = new MssEventGenerator();
            eventGenerator.Init(this.hostInfoRelayMock.Object,
                                this.wetEventRelayMock.Object,
                                this.dryEventRelayMock.Object,
                                this.genMappingMgrMock.Object,
                                this.mssParameterViewerMock.Object);
        }