public async Task GetSolutionHardwarePlanReplicasPaginatedAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetPaginatedAsync <Replica>(
                "/draas/v1/solutions/00000000-0000-0000-0000-000000000000/hardware-plans/11111111-1111-1111-1111-111111111111/replicas",
                null).Returns(Task.Run(() =>
                                       new Paginated <Replica>(client,
                                                               "/draas/v1/solutions/00000000-0000-0000-0000-000000000000/hardware-plans/11111111-1111-1111-1111-111111111111/replicas",
                                                               null,
                                                               new ClientResponse <IList <Replica> >()
            {
                Body = new ClientResponseBody <IList <Replica> >()
                {
                    Data = new List <Replica>()
                    {
                        new Replica(),
                        new Replica()
                    }
                }
            })));

            var ops            = new HardwarePlanReplicaOperations <Replica>(client);
            var solutionID     = "00000000-0000-0000-0000-000000000000";
            var hardwarePlanID = "11111111-1111-1111-1111-111111111111";
            var replicas       = await ops.GetSolutionHardwarePlanReplicasPaginatedAsync(solutionID, hardwarePlanID);

            Assert.AreEqual(2, replicas.Items.Count);
        }
        public async Task GetSolutionComputeResourcesPaginatedAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetPaginatedAsync <ComputeResource>(
                "/draas/v1/solutions/00000000-0000-0000-0000-000000000000/compute-resources", null).Returns(Task.Run(() =>
                                                                                                                     new Paginated <ComputeResource>(client, "/draas/v1/solutions/00000000-0000-0000-0000-000000000000/compute-resources", null,
                                                                                                                                                     new ClientResponse <IList <ComputeResource> >()
            {
                Body = new ClientResponseBody <IList <ComputeResource> >()
                {
                    Data = new List <ComputeResource>()
                    {
                        new ComputeResource(),
                        new ComputeResource()
                    }
                }
            })));

            var ops              = new ComputeResourceOperations <ComputeResource>(client);
            var solutionID       = "00000000-0000-0000-0000-000000000000";
            var computeResources = await ops.GetSolutionComputeResourcesPaginatedAsync(solutionID);

            Assert.AreEqual(2, computeResources.Items.Count);
        }
Esempio n. 3
0
        public async Task GetSolutionFailoverPlansPaginatedAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetPaginatedAsync <FailoverPlan>(
                "/draas/v1/solutions/00000000-0000-0000-0000-000000000000/failover-plans", null).Returns(Task.Run(() =>
                                                                                                                  new Paginated <FailoverPlan>(client, "/draas/v1/solutions/00000000-0000-0000-0000-000000000000/failover-plans", null,
                                                                                                                                               new ClientResponse <IList <FailoverPlan> >()
            {
                Body = new ClientResponseBody <IList <FailoverPlan> >()
                {
                    Data = new List <FailoverPlan>()
                    {
                        new FailoverPlan(),
                        new FailoverPlan()
                    }
                }
            })));

            var ops           = new FailoverPlanOperations <FailoverPlan>(client);
            var solutionID    = "00000000-0000-0000-0000-000000000000";
            var failoverPlans = await ops.GetSolutionFailoverPlansPaginatedAsync(solutionID);

            Assert.AreEqual(2, failoverPlans.Items.Count);
        }
Esempio n. 4
0
        public async Task StopSolutionFailoverPlanAsync_ValidParameters_ExpectedClientCall()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            var ops = new FailoverPlanOperations <FailoverPlan>(client);
            await ops.StopSolutionFailoverPlanAsync("00000000-0000-0000-0000-000000000000", "11111111-1111-1111-1111-111111111111");

            await client.Received()
            .PostAsync($"/draas/v1/solutions/00000000-0000-0000-0000-000000000000/failover-plans/11111111-1111-1111-1111-111111111111/stop");
        }
        public async Task UpdateSolutionAsync_ValidParameters_ExpectedClientCall()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            UpdateSolutionRequest req = new UpdateSolutionRequest
            {
                IOPSTierID = "11111111-1111-1111-1111-111111111111"
            };

            var ops = new SolutionOperations <Solution>(client);
            await ops.UpdateSolutionAsync("00000000-0000-0000-0000-000000000000", req);

            await client.Received().PatchAsync("/draas/v1/solutions/00000000-0000-0000-0000-000000000000", req);
        }
Esempio n. 6
0
        public async Task GetSolutionBackupServiceAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAsync <BackupService>($"/draas/v1/solutions/00000000-0000-0000-0000-000000000000/backup-service").Returns(new BackupService()
            {
                AccountName = "Test"
            });

            var ops           = new BackupServiceOperations <BackupService>(client);
            var backupService = await ops.GetSolutionBackupServiceAsync("00000000-0000-0000-0000-000000000000");

            Assert.AreEqual("Test", backupService.AccountName);
        }
        public async Task UpdateSolutionReplicaIOPSAsync_ValidParameters_ExpectedClientCall()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();
            var req = new UpdateReplicaIOPSRequest();

            var ops = new HardwarePlanReplicaOperations <Replica>(client);
            await ops.UpdateSolutionReplicaIOPSAsync("00000000-0000-0000-0000-000000000000",
                                                     "11111111-1111-1111-1111-111111111111", req);

            await client.Received()
            .PostAsync(
                $"/draas/v1/solutions/00000000-0000-0000-0000-000000000000/replicas/11111111-1111-1111-1111-111111111111/iops",
                req);
        }
        public async Task GetSolutionAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAsync <Solution>("/draas/v1/solutions/00000000-0000-0000-0000-000000000000").Returns(new Solution()
            {
                ID = "00000000-0000-0000-0000-000000000000"
            });

            var ops      = new SolutionOperations <Solution>(client);
            var solution = await ops.GetSolutionAsync("00000000-0000-0000-0000-000000000000");

            Assert.AreEqual("00000000-0000-0000-0000-000000000000", solution.ID);
        }
Esempio n. 9
0
        public async Task GetBillingTypeAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAsync <BillingType>("/draas/v1/billing-types/00000000-0000-0000-0000-000000000000")
            .Returns(new BillingType()
            {
                ID = "11111111-1111-1111-1111-111111111111"
            });

            var ops         = new BillingTypeOperations <BillingType>(client);
            var billingType = await ops.GetBillingTypeAsync("00000000-0000-0000-0000-000000000000");

            Assert.AreEqual("11111111-1111-1111-1111-111111111111", billingType.ID);
        }
        public async Task GetSolutionComputeResourceAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAsync <ComputeResource>("/draas/v1/solutions/00000000-0000-0000-0000-000000000000/compute-resources/11111111-1111-1111-1111-111111111111")
            .Returns(new ComputeResource()
            {
                ID = "11111111-1111-1111-1111-111111111111"
            });

            var ops             = new ComputeResourceOperations <ComputeResource>(client);
            var computeResource = await ops.GetSolutionComputeResourceAsync("00000000-0000-0000-0000-000000000000", "11111111-1111-1111-1111-111111111111");

            Assert.AreEqual("11111111-1111-1111-1111-111111111111", computeResource.ID);
        }
Esempio n. 11
0
        public async Task GetSolutionFailoverPlanAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAsync <FailoverPlan>("/draas/v1/solutions/00000000-0000-0000-0000-000000000000/failover-plans/11111111-1111-1111-1111-111111111111")
            .Returns(new FailoverPlan()
            {
                ID = "11111111-1111-1111-1111-111111111111"
            });

            var ops          = new FailoverPlanOperations <FailoverPlan>(client);
            var failoverPlan = await ops.GetSolutionFailoverPlanAsync("00000000-0000-0000-0000-000000000000", "11111111-1111-1111-1111-111111111111");

            Assert.AreEqual("11111111-1111-1111-1111-111111111111", failoverPlan.ID);
        }
Esempio n. 12
0
        public async Task GetIOPSTierAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAsync <IOPSTier>("/draas/v1/iops-tiers/00000000-0000-0000-0000-000000000000")
            .Returns(new IOPSTier()
            {
                ID = "11111111-1111-1111-1111-111111111111"
            });

            var ops      = new IOPSTierOperations <IOPSTier>(client);
            var iopsTier = await ops.GetIOPSTierAsync("00000000-0000-0000-0000-000000000000");

            Assert.AreEqual("11111111-1111-1111-1111-111111111111", iopsTier.ID);
        }
Esempio n. 13
0
        public async Task GetIOPSTiersAsync_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAllAsync(Arg.Any <UKFastClient.GetPaginatedAsyncFunc <IOPSTier> >(), null).Returns(Task.Run <IList <IOPSTier> >(() =>
                                                                                                                                      new List <IOPSTier>()
            {
                new IOPSTier(),
                new IOPSTier()
            }));

            var ops       = new IOPSTierOperations <IOPSTier>(client);
            var iopsTiers = await ops.GetIOPSTiersAsync();

            Assert.AreEqual(2, iopsTiers.Count);
        }
        public async Task GetSolutionBackupResourcesAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAllAsync(Arg.Any <UKFastClient.GetPaginatedAsyncFunc <BackupResource> >(), null).Returns(Task.Run <IList <BackupResource> >(() =>
                                                                                                                                                  new List <BackupResource>()
            {
                new BackupResource(),
                new BackupResource()
            }));

            var ops             = new BackupResourceOperations <BackupResource>(client);
            var backupResources = await ops.GetSolutionBackupResourcesAsync("00000000-0000-0000-0000-000000000000");

            Assert.AreEqual(2, backupResources.Count);
        }
Esempio n. 15
0
        public async Task GetBillingTypesAsync_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAllAsync(Arg.Any <UKFastClient.GetPaginatedAsyncFunc <BillingType> >(), null).Returns(Task.Run <IList <BillingType> >(() =>
                                                                                                                                            new List <BillingType>()
            {
                new BillingType(),
                new BillingType()
            }));

            var ops          = new BillingTypeOperations <BillingType>(client);
            var billingTypes = await ops.GetBillingTypesAsync();

            Assert.AreEqual(2, billingTypes.Count);
        }
        public async Task GetSolutionsAsync_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAllAsync(Arg.Any <UKFastClient.GetPaginatedAsyncFunc <Solution> >(), null).Returns(Task.Run <IList <Solution> >(() =>
                                                                                                                                      new List <Solution>()
            {
                new Solution(),
                new Solution()
            }));

            var ops       = new SolutionOperations <Solution>(client);
            var solutions = await ops.GetSolutionsAsync();

            Assert.AreEqual(2, solutions.Count);
        }
Esempio n. 17
0
        public async Task ResetSolutionBackupServiceCredentialsAsync_ValidParameters_ExpectedClientCall()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            var req = new ResetBackupServiceCredentialsRequest()
            {
                Password = "******"
            };

            var ops        = new BackupServiceOperations <BackupService>(client);
            var solutionID = "00000000-0000-0000-0000-000000000000";
            await ops.ResetSolutionBackupServiceCredentialsAsync(solutionID, req);

            await client.Received()
            .PostAsync($"/draas/v1/solutions/{solutionID}/backup-service/reset-credentials", req);
        }
Esempio n. 18
0
        public async Task GetSolutionFailoverPlansAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAllAsync(Arg.Any <UKFastClient.GetPaginatedAsyncFunc <FailoverPlan> >(), null).Returns(Task.Run <IList <FailoverPlan> >(() =>
                                                                                                                                              new List <FailoverPlan>()
            {
                new FailoverPlan(),
                new FailoverPlan()
            }));

            var ops           = new FailoverPlanOperations <FailoverPlan>(client);
            var solutionID    = "00000000-0000-0000-0000-000000000000";
            var failoverPlans = await ops.GetSolutionFailoverPlansAsync(solutionID);

            Assert.AreEqual(2, failoverPlans.Count);
        }
        public async Task GetSolutionHardwarePlanReplicasAsync_ValidParameters_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetAllAsync(Arg.Any <UKFastClient.GetPaginatedAsyncFunc <Replica> >(), null).Returns(
                Task.Run <IList <Replica> >(() =>
                                            new List <Replica>()
            {
                new Replica(),
                new Replica()
            }));

            var ops            = new HardwarePlanReplicaOperations <Replica>(client);
            var solutionID     = "00000000-0000-0000-0000-000000000000";
            var hardwarePlanID = "11111111-1111-1111-1111-111111111111";
            var replicas       = await ops.GetSolutionHardwarePlanReplicasAsync(solutionID, hardwarePlanID);

            Assert.AreEqual(2, replicas.Count);
        }
        public async Task GetSolutionsPaginatedAsync_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetPaginatedAsync <Solution>("/draas/v1/solutions").Returns(Task.Run(() =>
                                                                                        new Paginated <Solution>(client, "/draas/v1/solutions", null, new ClientResponse <IList <Solution> >()
            {
                Body = new ClientResponseBody <IList <Solution> >()
                {
                    Data = new List <Solution>()
                    {
                        new Solution(),
                        new Solution()
                    }
                }
            })));

            var ops       = new SolutionOperations <Solution>(client);
            var solutions = await ops.GetSolutionsPaginatedAsync(null);

            Assert.AreEqual(2, solutions.Items.Count);
        }
Esempio n. 21
0
        public async Task GetIOPSTiersPaginatedAsync_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetPaginatedAsync <IOPSTier>("/draas/v1/iops-tiers", null).Returns(Task.Run(() =>
                                                                                               new Paginated <IOPSTier>(client, "/draas/v1/iops-tiers", null,
                                                                                                                        new ClientResponse <IList <IOPSTier> >()
            {
                Body = new ClientResponseBody <IList <IOPSTier> >()
                {
                    Data = new List <IOPSTier>()
                    {
                        new IOPSTier(),
                        new IOPSTier()
                    }
                }
            })));

            var ops       = new IOPSTierOperations <IOPSTier>(client);
            var iopsTiers = await ops.GetIOPSTiersPaginatedAsync();

            Assert.AreEqual(2, iopsTiers.Items.Count);
        }
Esempio n. 22
0
        public async Task GetBillingTypesPaginatedAsync_ExpectedResult()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();

            client.GetPaginatedAsync <BillingType>("/draas/v1/billing-types", null).Returns(Task.Run(() =>
                                                                                                     new Paginated <BillingType>(client, "/draas/v1/billing-types", null,
                                                                                                                                 new ClientResponse <IList <BillingType> >()
            {
                Body = new ClientResponseBody <IList <BillingType> >()
                {
                    Data = new List <BillingType>()
                    {
                        new BillingType(),
                        new BillingType()
                    }
                }
            })));

            var ops          = new BillingTypeOperations <BillingType>(client);
            var billingTypes = await ops.GetBillingTypesPaginatedAsync();

            Assert.AreEqual(2, billingTypes.Items.Count);
        }
 public BackupResourceOperations(IUKFastDRaaSClient client) : base(client)
 {
 }
 public IOPSTierOperations(IUKFastDRaaSClient client) : base(client)
 {
 }
 public ComputeResourceOperations(IUKFastDRaaSClient client) : base(client)
 {
 }
Esempio n. 26
0
 public SolutionOperations(IUKFastDRaaSClient client) : base(client)
 {
 }
 public BillingTypeOperations(IUKFastDRaaSClient client) : base(client)
 {
 }
Esempio n. 28
0
 public HardwarePlanOperations(IUKFastDRaaSClient client) : base(client)
 {
 }
 public FailoverPlanOperations(IUKFastDRaaSClient client) : base(client)
 {
 }
Esempio n. 30
0
 public BackupServiceOperations(IUKFastDRaaSClient client) : base(client)
 {
 }