Esempio n. 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);
 }
        public void IncrementInvocationCount_MethodInvocationIncremented()
        {
            var invocationCounter = new MethodInvocationCounter();
            var currentMethod     = MethodBase.GetCurrentMethod() as MethodInfo;

            for (int i = 0; i < InvocationCount; ++i)
            {
                invocationCounter.IncrementInvocationCount(currentMethod);
            }

            Assert.That(invocationCounter.MethodCounts, Contains.Key(currentMethod));
            Assert.That(invocationCounter.MethodCounts[currentMethod], Is.EqualTo(InvocationCount));
        }
Esempio n. 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);
        }