Ejemplo n.º 1
0
        public void ShouldClonePosition()
        {
            StoragePosition position = new StoragePosition();
            StoragePosition cloned   = position.Clone();

            Assert.That(cloned, Is.Not.SameAs(position));
        }
Ejemplo n.º 2
0
        public StorageAllocation Allocate()
        {
            StoragePosition   allocated  = position.Clone();
            StorageAllocation allocation = new StorageAllocation(memory, allocated);

            return(allocation);
        }
Ejemplo n.º 3
0
        public void ShouldIncreaseHighPosition()
        {
            StoragePosition position = new StoragePosition();

            position.Increase(100);

            Assert.That(position.High, Is.EqualTo(100));
        }
Ejemplo n.º 4
0
        public void ShouldIncreaseLowPosition()
        {
            StoragePosition position = new StoragePosition();

            position.Increase(100);
            position.Decrease(50);

            Assert.That(position.Low, Is.EqualTo(50));
        }
Ejemplo n.º 5
0
        public void ShouldHaveRequestedPosition()
        {
            Memory          memory   = new Memory(1024);
            StoragePosition position = new StoragePosition();

            position.Increase(300);
            StorageAllocation allocation = new StorageAllocation(memory, position);

            Assert.That(allocation.Position, Is.EqualTo(300));
        }
Ejemplo n.º 6
0
        public void ShouldWriteToAllocatedPosition()
        {
            Memory          memory   = new Memory(1024);
            StoragePosition position = new StoragePosition();

            position.Increase(300);
            StorageAllocation allocation = new StorageAllocation(memory, position);

            allocation.Set(12, 23);
            Assert.That(memory.Get(312), Is.EqualTo(23));
        }
        //放入队列指定位置
        override public void PutIn(StoragePosition Pos, TrackingUnit2 Item)
        {
            if (Pos.DimensionCount == 1)
            {
                Int16 PosX = Pos.GetDiemensionValue(StoragePositionDimension.X);

                PutIn(PosX, Item);
            }
            else
            {
                throw new Exception(_storageName + "位置坐标维度错误");
            }
        }
        //从指定位置拿出
        override public TrackingUnit2 TakeOut(StoragePosition Pos)
        {
            if (Pos.DimensionCount == 1)
            {
                int PosX = Pos.GetDiemensionValue(StoragePositionDimension.X);

                return(TakeOut(PosX));
            }
            else
            {
                throw new Exception(_storageName + "位置坐标维度错误");
            }
        }
 //查询队列
 override public string GetPositionItemID(StoragePosition Pos)
 {
     return(GetDBItemAtPosition(Pos.GetDiemensionValue()));
 }
Ejemplo n.º 10
0
 public StorageAllocation(Memory memory, StoragePosition position)
 {
     this.memory   = memory;
     this.position = position;
 }
Ejemplo n.º 11
0
        public void ShouldHaveIntialLowPosition()
        {
            StoragePosition position = new StoragePosition();

            Assert.That(position.Low, Is.Zero);
        }
Ejemplo n.º 12
0
 public Storage(int blockSize)
 {
     this.memory   = new Memory(blockSize);
     this.position = new StoragePosition();
 }