public void TestEnqueue()
        {
            var elem1 = "elem1";
            var elem2 = "elem2";

            _sut.Enqueue(elem1);
            Assert.AreEqual(elem1, _sut.Front);
            Assert.AreEqual(1, _sut.Size());
            Assert.IsFalse(_sut.IsEmpty());
            _sut.Enqueue(elem2);
            Assert.AreEqual(elem1, _sut.Front);
            Assert.AreEqual(2, _sut.Size());
            Assert.IsFalse(_sut.IsEmpty());
        }
Пример #2
0
        SimEvents ResourceRequester(PreemptiveResource resource, ILinkedQueue <SimProcess> completed)
        {
            using (var req = resource.Request()) {
                yield return(req);

                completed.Enqueue(Env.ActiveProcess);
                yield return(Env.Timeout(10));
            }
        }
Пример #3
0
        SimEvents ResourceRequester_WithPriority(Resource resource, ILinkedQueue <SimProcess> completed, double priority)
        {
            using (var req = resource.Request(priority)) {
                yield return(req);

                completed.Enqueue(Env.ActiveProcess);
                yield return(Env.Timeout(10));
            }
        }