Esempio n. 1
0
        protected void Setup()
        {
            StatsdMock = new Mock <IVeStatsDClient>();
            Container  = new WindsorContainer();

            Container.Register(Component.For <IVeStatsDClient>().Instance(StatsdMock.Object));
            Container.Register(Component.For <StatsDTimingInterceptor>());
            Container.Register(Component.For <ITestGeneric <Foo>, ITestGeneric <Bar> >()
                               .ImplementedBy <TestGenerics>()
                               .Interceptors <StatsDTimingInterceptor>());

            FooService = Container.Resolve <ITestGeneric <Foo> >();
            BarService = Container.Resolve <ITestGeneric <Bar> >();
        }
        protected void Setup()
        {
            StatsdMock = new Mock<IVeStatsDClient>();
            Container = new WindsorContainer();

            Container.Register(Component.For<IVeStatsDClient>().Instance(StatsdMock.Object));
            Container.Register(Component.For<StatsDTimingInterceptor>());
            Container.Register(Component.For<ITestGeneric<Foo>, ITestGeneric<Bar>>()
                .ImplementedBy<TestGenerics>()
                .Interceptors<StatsDTimingInterceptor>());

            FooService = Container.Resolve<ITestGeneric<Foo>>();
            BarService = Container.Resolve<ITestGeneric<Bar>>();
        }
Esempio n. 3
0
        protected void Setup()
        {
            StatsdMock = new Mock <IVeStatsDClient>();
            Container  = new Container();

            Container.RegisterSingleton <IVeStatsDClient>(StatsdMock.Object);
            Container.RegisterSingleton <ITestGeneric <Foo>, TestGenerics>();
            Container.RegisterSingleton <ITestGeneric <Bar>, TestGenerics>();
            Container.InterceptWith <StatsDTimingInterceptor>(type => type == typeof(ITestGeneric <Foo>));
            Container.InterceptWith <StatsDTimingInterceptor>(type => type == typeof(ITestGeneric <Bar>));

            FooService = Container.GetInstance <ITestGeneric <Foo> >();
            BarService = Container.GetInstance <ITestGeneric <Bar> >();

            StatsdMock.Setup(x => x.LogTiming(It.IsAny <string>(), It.IsAny <long>(), It.IsAny <Dictionary <string, string> >()));
        }
 public void callgeneric <T>(ITestGeneric <T> it, T t)
 {
     it.genericFunc(t);
 }