public void TestNotEmpty()
        {
            MemoryStream xvaStream = new MemoryStream();
            VirtualMachineBuilder vmb = new VirtualMachineBuilder();

            MemoryStream ms = new MemoryStream();
            for (int i = 0; i < 1024 * 1024; ++i)
            {
                ms.Position = i * 10;
                ms.WriteByte((byte)(i ^ (i >> 8) ^ (i >> 16) ^ (i >> 24)));
            }

            vmb.AddDisk("Foo", ms, Ownership.Dispose);
            vmb.Build(xvaStream);

            Assert.AreNotEqual(0, xvaStream.Length);

            VirtualMachine vm = new VirtualMachine(xvaStream);
            List<Disk> disks = new List<Disk>(vm.Disks);
            Assert.AreEqual(1, disks.Count);
            Assert.AreEqual(10 * 1024 * 1024, disks[0].Capacity);

            Stream diskContent = disks[0].Content;
            for (int i = 0; i < 1024 * 1024; ++i)
            {
                diskContent.Position = i * 10;
                if ((byte)(i ^ (i >> 8) ^ (i >> 16) ^ (i >> 24)) != diskContent.ReadByte())
                {
                    Assert.Fail("Mismatch at offset " + i);
                }
            }
        }
        public void TestNotEmpty()
        {
            MemoryStream          xvaStream = new MemoryStream();
            VirtualMachineBuilder vmb       = new VirtualMachineBuilder();

            MemoryStream ms = new MemoryStream();

            for (int i = 0; i < 1024 * 1024; ++i)
            {
                ms.Position = i * 10;
                ms.WriteByte((byte)(i ^ (i >> 8) ^ (i >> 16) ^ (i >> 24)));
            }

            vmb.AddDisk("Foo", ms, Ownership.Dispose);
            vmb.Build(xvaStream);

            Assert.AreNotEqual(0, xvaStream.Length);

            VirtualMachine vm    = new VirtualMachine(xvaStream);
            List <Disk>    disks = new List <Disk>(vm.Disks);

            Assert.AreEqual(1, disks.Count);
            Assert.AreEqual(10 * 1024 * 1024, disks[0].Capacity);

            Stream diskContent = disks[0].Content;

            for (int i = 0; i < 1024 * 1024; ++i)
            {
                diskContent.Position = i * 10;
                if ((byte)(i ^ (i >> 8) ^ (i >> 16) ^ (i >> 24)) != diskContent.ReadByte())
                {
                    Assert.Fail("Mismatch at offset " + i);
                }
            }
        }
        public void TestEmpty()
        {
            MemoryStream xvaStream = new MemoryStream();
            VirtualMachineBuilder vmb = new VirtualMachineBuilder();
            vmb.AddDisk("Foo", new MemoryStream(), Ownership.Dispose);
            vmb.Build(xvaStream);

            Assert.AreNotEqual(0, xvaStream.Length);

            VirtualMachine vm = new VirtualMachine(xvaStream);
            List<Disk> disks = new List<Disk>(vm.Disks);
            Assert.AreEqual(1, disks.Count);
            Assert.AreEqual(0, disks[0].Capacity);
        }
        public void TestEmpty()
        {
            MemoryStream          xvaStream = new MemoryStream();
            VirtualMachineBuilder vmb       = new VirtualMachineBuilder();

            vmb.AddDisk("Foo", new MemoryStream(), Ownership.Dispose);
            vmb.Build(xvaStream);

            Assert.AreNotEqual(0, xvaStream.Length);

            VirtualMachine vm    = new VirtualMachine(xvaStream);
            List <Disk>    disks = new List <Disk>(vm.Disks);

            Assert.AreEqual(1, disks.Count);
            Assert.AreEqual(0, disks[0].Capacity);
        }