示例#1
0
        public async Task CreateVirtualMachineTemplateAsync_ExpectedResult()
        {
            CreateVirtualMachineTemplateRequest req = new CreateVirtualMachineTemplateRequest()
            {
                TemplateName = "testtemplate"
            };

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

            var ops = new VirtualMachineOperations <VirtualMachine>(client);
            await ops.CreateVirtualMachineTemplateAsync(123, req);

            await client.Received().PostAsync("/ecloud/v1/vms/123/clone-to-template", req);
        }
示例#2
0
        public async Task CreateVirtualMachineTemplateAsync_InvalidVirtualMachineID_ThrowsUKFastClientValidationException()
        {
            var ops = new VirtualMachineOperations <VirtualMachine>(null);

            await Assert.ThrowsExceptionAsync <UKFastClientValidationException>(() => ops.CreateVirtualMachineTemplateAsync(0, null));
        }