예제 #1
0
        public void GenericWorkerInstrumentationWriter_InstrumentationIntervalTest()
        {
            var intervalEventArgs = new IntervalEventArgs()
            {
                IntervalTime       = new TimeSpan(0, 0, 60),
                TotalTime          = new TimeSpan(0, 60, 0),
                WorkerStateDetails = new List <WorkerStateDetail>()
                {
                    new WorkerStateDetail()
                    {
                        Name = "Test", StopwatchActive = new Stopwatch(), StopwatchInterval = new Stopwatch()
                    }
                },
                IntervalProcessedMessageCountByMethod = new Dictionary <string, int>()
            };

            var jsonHelperMock = new Mock <IJSonRPCHelper>();

            IUnityContainer container = new UnityContainer();

            container.RegisterInstance(typeof(IJSonRPCHelper), jsonHelperMock.Object);

            //Act
            var genericWorkerInstrumentationWriter = new GenericWorkerInstrumentationWriter(container);

            genericWorkerInstrumentationWriter.InstrumentationInterval(this, intervalEventArgs);

            System.Threading.Thread.Sleep(500);

            jsonHelperMock.Verify(j => j.SerializeJSonRPCRequest(It.IsAny <JsonRequest>()), Times.Once());
        }
예제 #2
0
        public void GenericWorkerInstrumentationWriter_ResolveInstrumentationDotWrite()
        {
            var jsonHelperMock = new Mock <IJSonRPCHelper>();

            IUnityContainer container = new UnityContainer();

            container.RegisterInstance(typeof(IJSonRPCHelper), jsonHelperMock.Object);

            //Act
            var genericWorkerInstrumentationWriter = new GenericWorkerInstrumentationWriter(container);
        }