public void VirtualDiskExpand_DynamicVHDX() { string vhdxpath = Path.Combine(Environment.CurrentDirectory, "testvhdx.vhdx"); if (File.Exists(vhdxpath)) { File.Delete(vhdxpath); } using (VirtualDisk vdisk = VirtualDisk.Create(vhdxpath, VirtualDiskType.VHDX, 4 * 1024 * 1024)) { Assert.IsNotNull(vdisk); Assert.AreEqual((ulong)(4 * 1024 * 1024), vdisk.VirtualSize); vdisk.Expand(8 * 1024 * 1024); Assert.AreEqual((ulong)(8 * 1024 * 1024), vdisk.VirtualSize); } }
public void VirtualDiskExpand_FixedVHD() { string vhdpath = Path.Combine(Environment.CurrentDirectory, "testvhd.vhd"); if (File.Exists(vhdpath)) { File.Delete(vhdpath); } using (VirtualDisk vdisk = VirtualDisk.Create(vhdpath, VirtualDiskType.VHDX, 4 * 1024 * 1024, VirtualDiskCreateFlags.FullPhysicalAllocation)) { Assert.IsNotNull(vdisk); Assert.AreEqual((ulong)(4 * 1024 * 1024), vdisk.VirtualSize); vdisk.Expand(8 * 1024 * 1024); Assert.AreEqual((ulong)(8 * 1024 * 1024), vdisk.VirtualSize); } }