示例#1
0
        public async Task CreateVirtualMachineAsync_ExpectedResult()
        {
            CreateVirtualMachineRequest req = new CreateVirtualMachineRequest()
            {
                Template = "testtemplate"
            };

            IUKFastECloudClient client = Substitute.For <IUKFastECloudClient>();

            client.PostAsync <VirtualMachine>("/ecloud/v1/vms", req).Returns(new VirtualMachine()
            {
                ID = 123
            });

            var ops  = new VirtualMachineOperations <VirtualMachine>(client);
            var vmID = await ops.CreateVirtualMachineAsync(req);

            Assert.AreEqual(123, vmID);
        }