Ejemplo n.º 1
0
 public async Task StartSolutionFailoverPlanAsync_InvalidFailoverPlanID_ThrowsUKFastClientValidationException()
 {
     var req = new StartFailoverPlanRequest();
     var ops = new FailoverPlanOperations <FailoverPlan>(null);
     await Assert.ThrowsExceptionAsync <UKFastClientValidationException>(() =>
                                                                         ops.StartSolutionFailoverPlanAsync("00000000-0000-0000-0000-000000000000", "", req));
 }
Ejemplo n.º 2
0
        public async Task StartSolutionFailoverPlanAsync_ValidParameters_ExpectedClientCall()
        {
            IUKFastDRaaSClient client = Substitute.For <IUKFastDRaaSClient>();
            var req = new StartFailoverPlanRequest();

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

            await client.Received()
            .PostAsync($"/draas/v1/solutions/00000000-0000-0000-0000-000000000000/failover-plans/11111111-1111-1111-1111-111111111111/start", req);
        }
        public async Task StartSolutionFailoverPlanAsync(string solutionID, string failoverPlanID, StartFailoverPlanRequest req)
        {
            if (string.IsNullOrWhiteSpace(solutionID))
            {
                throw new UKFastClientValidationException("Invalid solution id");
            }

            if (string.IsNullOrWhiteSpace(failoverPlanID))
            {
                throw new UKFastClientValidationException("Invalid failover plan id");
            }

            await this.Client.PostAsync($"/draas/v1/solutions/{solutionID}/failover-plans/{failoverPlanID}/start", req);
        }