Example #1
0
 public void BeforeTest()
 {
     this.instrumentationExampleMock = new Mock <IInstrumentationExample>();
     this.invocationCounter          = new MethodInvocationCounter();
     this.invocationTimer            = new MethodInvocationTimer();
     this.dateTimeProviderMock       = new Mock <IDateTimeProvider>();
     this.guidProviderMock           = new Mock <IGuidProvider>();
 }
 public void BeforeTest()
 {
     this.invocationCounter = new MethodInvocationCounter();
     this.invocationTimer   = new MethodInvocationTimer();
     this.registrarMock     = new Mock <IRegistrar>();
     this.guidProviderMock  = new Mock <IGuidProvider>();
     this.guidProviderMock
     .Setup(g => g.NewGuid())
     .Returns(Guid);
 }
Example #3
0
        public void AddInvocationTime_MethodTimesAdded()
        {
            var invocationTimer = new MethodInvocationTimer();
            var currentMethod   = MethodBase.GetCurrentMethod() as MethodInfo;

            foreach (int invocationTime in InvocationTimes)
            {
                invocationTimer.AddInvocationTime(
                    currentMethod,
                    TimeSpan.FromTicks(invocationTime));
            }

            Assert.That(invocationTimer.MethodTimes, Contains.Key(currentMethod));
            Assert.That(
                invocationTimer.MethodTimes[currentMethod],
                Is.EqualTo(InvocationTimes.Select(t => new TimeSpan(t))));
        }
Example #4
0
        public void BeforeTest()
        {
            this.invocationCounter    = new MethodInvocationCounter();
            this.invocationTimer      = new MethodInvocationTimer();
            this.dateTimeProviderMock = new Mock <IDateTimeProvider>();
            this.guidProviderMock     = new Mock <IGuidProvider>();
            var currentMethod = MethodBase.GetCurrentMethod() as MethodInfo;

            this.invocationCounter.IncrementInvocationCount(currentMethod);
            this.invocationTimer
            .AddInvocationTime(currentMethod, TimeSpan.FromTicks(InvocationTime));
            this.dateTimeProviderMock
            .SetupGet(d => d.Now)
            .Returns(new DateTime(DateTimeTicks));
            this.guidProviderMock
            .Setup(g => g.NewGuid())
            .Returns(Guid);
        }