public virtual void TestInvalidate() { SimulatedFSDataset fsdataset = GetSimulatedFSDataset(); int bytesAdded = AddSomeBlocks(fsdataset); Block[] deleteBlocks = new Block[2]; deleteBlocks[0] = new Block(1, 0, 0); deleteBlocks[1] = new Block(2, 0, 0); fsdataset.Invalidate(bpid, deleteBlocks); CheckInvalidBlock(new ExtendedBlock(bpid, deleteBlocks[0])); CheckInvalidBlock(new ExtendedBlock(bpid, deleteBlocks[1])); long sizeDeleted = BlockIdToLen(1) + BlockIdToLen(2); NUnit.Framework.Assert.AreEqual(bytesAdded - sizeDeleted, fsdataset.GetDfsUsed()); NUnit.Framework.Assert.AreEqual(fsdataset.GetCapacity() - bytesAdded + sizeDeleted , fsdataset.GetRemaining()); // Now make sure the rest of the blocks are valid for (int i = 3; i <= Numblocks; ++i) { Block b = new Block(i, 0, 0); NUnit.Framework.Assert.IsTrue(fsdataset.IsValidBlock(new ExtendedBlock(bpid, b))); } }