public async Task DefaultOptionsYieldExpectedDictionarySize()
        {
            var eventCount = 0;
            var itemCount  = 0;

            var proxy = new PerInstanceAdapter <IForTestingPurposes>
                        (
                Process.Lean(EventProcessor)
                        )
                        .Adapt(new ForTestingPurposes());


            await proxy.AsyncAction(0, "zero");

            Thread.Sleep(1000);

            Assert.Equal(1, eventCount);
            Assert.Equal(BitFunctions.CountSet((int)CaptureOptions.Default), itemCount);

            void EventProcessor(IDictionary <string, object> @event)
            {
                eventCount++;
                itemCount = @event.Count;
            }
        }
Ejemplo n.º 2
0
        public void DefaultOptionsYieldExpectedDictionarySize()
        {
            var eventCount = 0;
            var itemCount  = 0;

            var proxy = new PerMethodAdapter <ForTestingPurposes>
                        (
                Process.Lean(EventProcessor)
                        )
                        .Profile(x => x.VirtualMethodCall(It.IsAny <int>(), It.IsAny <string>()))
                        .Adapt(new ForTestingPurposes());

            proxy.VirtualMethodCall(0, "zero");

            Assert.Equal(1, eventCount);
            Assert.Equal(BitFunctions.CountSet((int)CaptureOptions.Default), itemCount);

            void EventProcessor(IDictionary <string, object> @event)
            {
                eventCount++;
                itemCount = @event.Count;
            }
        }