public void Can_check_used_disk_and_ram_per_machine() { CloudInfrastructure cloud = new CloudInfrastructure(); cloud.CreateMachine("machine1", "Linux", "50gb", "8gb"); Assert.AreEqual("machine1:Inactive", cloud.ListMachines()); Assert.AreEqual(0, cloud.UsedMemoryMachine("machine1"), 0.00001); // Only running machines consume memory Assert.AreEqual(50, cloud.UsedDiskMachine("machine1"), 0.00001); // the disk is always consumed cloud.StartMachine("machine1"); Assert.AreEqual(8, cloud.UsedMemoryMachine("machine1"), 0.00001); // All the machine memory is used as it is now running Assert.AreEqual(50, cloud.UsedDiskMachine("machine1"), 0.00001); cloud.StopMachine("machine1"); // The memory will be released as the machine has been stopped Assert.AreEqual(0, cloud.UsedMemoryMachine("machine1"), 0.00001); Assert.AreEqual(50, cloud.UsedDiskMachine("machine1"), 0.00001); }