Exemplo n.º 1
0
        public void AdvancedAMAgatherInfoTestMethod()
        {
            //Setup communicatro stub
            List <MQCommodityWrapper> mqCommodityWrapper = new List <MQCommodityWrapper>();
            List <MQReqWrapper>       mqReqyWrapper      = new List <MQReqWrapper>();
            MQUser mqUser             = new MQUser();
            CommStubStaticReturn comm = new CommStubStaticReturn();

            comm.qAllmarket   = mqCommodityWrapper;
            comm.qAllrequests = mqReqyWrapper;
            comm.quser        = mqUser;

            //Run AMA for a while
            AdvancedAMA agent = new AdvancedAMA(3, 1000, comm);

            agent.enable(true);
            System.Threading.Thread.Sleep(1500);
            agent.enable(false);


            //Verify if AMA has collected the info from the communicator stub
            Assert.IsNotNull(agent.commoditiesInfo);
            Assert.IsNotNull(agent.requestsInfo);
            Assert.IsNotNull(agent.userData);
            Assert.AreEqual(mqCommodityWrapper, agent.commoditiesInfo);
            Assert.AreEqual(mqReqyWrapper, agent.requestsInfo);
            Assert.AreEqual(mqUser, agent.userData);
        }
Exemplo n.º 2
0
        public void TestInitialize()
        {
            //Create stub communicator and pass it to the AMA
            commodity = 0;
            MQCommodity        qmarket        = new MQCommodity(); qmarket.ask = "10";
            MQCommodityWrapper qmarketWrapper = new MQCommodityWrapper();

            qmarketWrapper.info = qmarket; qmarketWrapper.id = commodity;
            List <MQCommodityWrapper> stubResponse = new List <MQCommodityWrapper>(); stubResponse.Add(qmarketWrapper);

            comm            = new CommStubStaticReturn();
            comm.qAllmarket = stubResponse;
            agent           = new AdvancedAMA(3 + 1, 1000, comm);
        }