public async Task GetVirtualMachineAsync_ValidParameters_ExpectedResult() { IUKFastECloudClient client = Substitute.For <IUKFastECloudClient>(); client.GetAsync <VirtualMachine>("/ecloud/v1/vms/123").Returns(new VirtualMachine() { ID = 123 }); var ops = new VirtualMachineOperations <VirtualMachine>(client); var vm = await ops.GetVirtualMachineAsync(123); Assert.AreEqual(123, vm.ID); }
public async Task GetVirtualMachineAsync_InvalidVirtualMachineID_ThrowsUKFastClientValidationException() { var ops = new VirtualMachineOperations <VirtualMachine>(null); await Assert.ThrowsExceptionAsync <UKFastClientValidationException>(() => ops.GetVirtualMachineAsync(0)); }