コード例 #1
0
        public void EndReplicationEventConstructorTest()
        {
            DateTime            eventTime = new DateTime();
            EndReplicationEvent target    = new EndReplicationEvent(eventTime);

            Assert.IsInstanceOfType(target, typeof(EndReplicationEvent));
        }
コード例 #2
0
        public void CreateProcessArgsForTestEndReplication()
        {
            DateTime           beginTime             = DateTime.Now;
            TimeSpan           runningTime           = new TimeSpan(2, 0, 0);
            double             callArriveMultiplier  = 0.1;
            double             switchDelayMultiplier = 0.1;
            List <ProductType> productTypes          = new List <ProductType> {
                new ProductType("Test", 0.1, 0.1)
            };
            int      maxQueueLength                = 10;
            bool     singleQueueLength             = true;
            TimeSpan excessiveWaitTime             = new TimeSpan(0, 1, 0);
            Dictionary <SalesRepType, int> repNums = new Dictionary <SalesRepType, int>();

            repNums.Add(new SalesRepType("Test"), 2);
            Simulator sim = new Simulator(beginTime, runningTime, callArriveMultiplier, switchDelayMultiplier, productTypes, maxQueueLength, singleQueueLength, excessiveWaitTime, repNums);
            ProcessArgsFactory_Accessor target = new ProcessArgsFactory_Accessor(sim);

            Event e = new EndReplicationEvent(DateTime.Now);

            EventProcessArgs actual;

            actual = target.CreateProcessArgsFor(e);
            Assert.IsInstanceOfType(actual, typeof(EndReplicationProcessArgs));
        }
コード例 #3
0
        public void EventsTest()
        {
            Calendar target = new Calendar();

            Event callArrive = new CallArriveEvent(null, DateTime.Now.AddMinutes(10));

            target.AddEvent(callArrive);
            Event switchComp = new SwitchCompletedEvent(null, DateTime.Now.AddMinutes(5));

            target.AddEvent(switchComp);
            Event serviceComp = new CompletedServiceEvent(null, DateTime.Now.AddMinutes(20));

            target.AddEvent(serviceComp);
            Event endRep = new EndReplicationEvent(DateTime.Now.AddMinutes(30));

            target.AddEvent(endRep);

            List <Event> expected = new List <Event> {
                switchComp, callArrive, serviceComp, endRep
            };

            List <Event> actual;

            actual = target.Events;
            for (int i = 0; i < expected.Count; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }
        public void ProcessedEventTestNormal()
        {
            Simulator.SimulationEventArgs target = new Simulator.SimulationEventArgs();
            Event expected = new EndReplicationEvent(DateTime.Now);
            Event actual;

            target.ProcessedEvent = expected;
            actual = target.ProcessedEvent;
            Assert.AreEqual(expected, actual);
        }
        public void Simulator_SimulationEventArgsConstructorTest()
        {
            Event test = new EndReplicationEvent(DateTime.Now);

            Simulator.SimulationEventArgs target = new Simulator.SimulationEventArgs {
                ProcessedEvent = test
            };

            Assert.IsInstanceOfType(target, typeof(Simulator.SimulationEventArgs));
            Assert.AreEqual(test, target.ProcessedEvent);
        }
コード例 #6
0
        public void RemoveEventTestMultipleItems()
        {
            Calendar target     = new Calendar();
            Event    callArrive = new CallArriveEvent(null, DateTime.Now.AddMinutes(10));

            target.AddEvent(callArrive);
            Event switchComp = new SwitchCompletedEvent(null, DateTime.Now.AddMinutes(5));

            target.AddEvent(switchComp);
            Event serviceComp = new CompletedServiceEvent(null, DateTime.Now.AddMinutes(20));

            target.AddEvent(serviceComp);
            Event endRep = new EndReplicationEvent(DateTime.Now.AddMinutes(30));

            target.AddEvent(endRep);
            target.RemoveEvent(callArrive);
            Assert.AreEqual(3, target.Events.Count);
        }
コード例 #7
0
        public void NextEventOfTypeTestWithInvalidEnumReturnsNull()
        {
            Calendar target     = new Calendar();
            Event    callArrive = new CallArriveEvent(null, DateTime.Now.AddMinutes(10));

            target.AddEvent(callArrive);
            Event switchComp  = new SwitchCompletedEvent(null, DateTime.Now.AddMinutes(5));
            Event serviceComp = new CompletedServiceEvent(null, DateTime.Now.AddMinutes(20));

            target.AddEvent(serviceComp);
            Event endRep = new EndReplicationEvent(DateTime.Now.AddMinutes(30));

            target.AddEvent(endRep);

            Event actual;

            actual = target.NextEventOfType((EEventType)10);
            Assert.IsNull(actual);
        }
コード例 #8
0
        public void NextEventOfTypeTestWithItemMatchEndReplication()
        {
            Calendar target     = new Calendar();
            Event    callArrive = new CallArriveEvent(null, DateTime.Now.AddMinutes(10));

            target.AddEvent(callArrive);
            Event switchComp = new SwitchCompletedEvent(null, DateTime.Now.AddMinutes(5));

            target.AddEvent(switchComp);
            Event serviceComp = new CompletedServiceEvent(null, DateTime.Now.AddMinutes(20));

            target.AddEvent(serviceComp);
            Event endRep = new EndReplicationEvent(DateTime.Now.AddMinutes(30));

            target.AddEvent(endRep);

            Event actual;

            actual = target.NextEventOfType(EEventType.EndReplication);
            Assert.AreEqual(endRep, actual);
        }