public void ShouldClonePosition() { StoragePosition position = new StoragePosition(); StoragePosition cloned = position.Clone(); Assert.That(cloned, Is.Not.SameAs(position)); }
public StorageAllocation Allocate() { StoragePosition allocated = position.Clone(); StorageAllocation allocation = new StorageAllocation(memory, allocated); return(allocation); }
public void ShouldIncreaseHighPosition() { StoragePosition position = new StoragePosition(); position.Increase(100); Assert.That(position.High, Is.EqualTo(100)); }
public void ShouldIncreaseLowPosition() { StoragePosition position = new StoragePosition(); position.Increase(100); position.Decrease(50); Assert.That(position.Low, Is.EqualTo(50)); }
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)); }
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())); }
public StorageAllocation(Memory memory, StoragePosition position) { this.memory = memory; this.position = position; }
public void ShouldHaveIntialLowPosition() { StoragePosition position = new StoragePosition(); Assert.That(position.Low, Is.Zero); }
public Storage(int blockSize) { this.memory = new Memory(blockSize); this.position = new StoragePosition(); }