Ejemplo n.º 1
0
        public void Setup()
        {
            var roomServiceMock = new Mock <IRoomService>();

            roomServiceMock.Setup(x => x.JoinRoom(7)).Returns(true);
            var commandStoreMock = new Mock <ICommandStore>();
            var httpServiceMock  = new Mock <IHttpService>();
            var coll             = new ServiceCollection();

            coll.AddSingleton <ICommandStore, ICommandStore>(x => commandStoreMock.Object);
            coll.AddSingleton <IRoomService, IRoomService>(x => roomServiceMock.Object);
            coll.AddSingleton <IHttpService, IHttpService>(x => httpServiceMock.Object);
            _commandFactory = new CommandFactory(coll);

            coll.Should().HaveCount(3);
            _priorityProcessor = new PriorityProcessor(commandStoreMock.Object, httpServiceMock.Object,
                                                       _commandFactory);
        }
        public void Init()
        {
            IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory;

            IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-timeout-cache-config5.xml");

            ccf.Config = config;

            m_cache = CacheFactory.GetCache("dist-test");

            m_cache.Clear();

            m_cache[m_key] = 10.0;

            SlowProcessor slowProcessor = new SlowProcessor
            {
                Time        = 10000,
                ReturnValue = m_expectedResult
            };


            m_priorityProcessorDefault = new PriorityProcessor(slowProcessor)
            {
                RequestTimeoutMillis = (long)PriorityTaskTimeout.Default
            };

            m_priorityProcessorNone = new PriorityProcessor(slowProcessor)
            {
                RequestTimeoutMillis = (long)PriorityTaskTimeout.None
            };

            SlowAggregator slowAggregator = new SlowAggregator();

            m_priorityAggregatorDefault = new PriorityAggregator(slowAggregator)
            {
                RequestTimeoutMillis = (long)PriorityTaskTimeout.Default
            };

            m_priorityAggregatorNone = new PriorityAggregator(slowAggregator)
            {
                RequestTimeoutMillis = (long)PriorityTaskTimeout.None
            };
        }