Example #1
0
        //[Test()]
        public void DetachTest()
        {
            const int sz = 0x03010400;

            try
            {
                using (var vhd = VirtualDisk.Create(tmpfn, sz))
                {
                    Assert.That(vhd.Attached, Is.False);
                    vhd.Attach(false, false);
                    Assert.That(vhd.Attached, Is.False);
                }
                Assert.That(VirtualDisk.GetAllAttachedVirtualDiskPaths(), Has.Some.EqualTo(tmpfn));
                Assert.That(() => VirtualDisk.Detach(tmpfn), Throws.Nothing);
                Assert.That(VirtualDisk.GetAllAttachedVirtualDiskPaths(), Is.Empty);
            }
            finally
            {
                System.IO.File.Delete(tmpfn);
            }
        }