Пример #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);
        }
Пример #2
0
 public async Task <int> CreateVirtualMachineAsync(CreateVirtualMachineRequest req)
 {
     return((await this.Client.PostAsync <VirtualMachine>($"/ecloud/v1/vms", req)).ID);
 }