Esempio n. 1
0
 public static PSValidateProbeOutput ToPsValideProbeOutput(
     this ValidateProbeOutput output)
 {
     return(new PSValidateProbeOutput
     {
         Message = output.Message,
         ErrorCode = output.ErrorCode,
         IsValid = output.IsValid
     });
 }
        public async Task Validate()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

            Uri probeURL = new Uri("https://azurecdn-files.azureedge.net/dsa-test/probe-v.txt");
            ValidateProbeInput  validateProbeInput2 = new ValidateProbeInput(probeURL);
            ValidateProbeOutput ValidateProbeOutput = await subscription.ValidateProbeAsync(validateProbeInput2);

            Assert.True(ValidateProbeOutput.IsValid);
            probeURL = new Uri("https://www.notexist.com/notexist/notexist.txt");
            ValidateProbeInput validateProbeInput3 = new ValidateProbeInput(probeURL);

            ValidateProbeOutput = await subscription.ValidateProbeAsync(validateProbeInput3);

            Assert.False(ValidateProbeOutput.IsValid);
        }
Esempio n. 3
0
        public async Task Validate()
        {
            string             probeURL            = "www.withoutHttp.com";
            ValidateProbeInput validateProbeInput1 = new ValidateProbeInput(probeURL);
            Subscription       subscription        = await Client.GetDefaultSubscriptionAsync();

            Assert.ThrowsAsync <RequestFailedException>(async() => await subscription.ValidateProbeAsync(validateProbeInput1));
            probeURL = "https://azurecdn-files.azureedge.net/dsa-test/probe-v.txt";
            ValidateProbeInput  validateProbeInput2 = new ValidateProbeInput(probeURL);
            ValidateProbeOutput ValidateProbeOutput = await subscription.ValidateProbeAsync(validateProbeInput2);

            Assert.True(ValidateProbeOutput.IsValid);
            probeURL = "https://www.notexist.com/notexist/notexist.txt";
            ValidateProbeInput validateProbeInput3 = new ValidateProbeInput(probeURL);

            ValidateProbeOutput = await subscription.ValidateProbeAsync(validateProbeInput3);

            Assert.False(ValidateProbeOutput.IsValid);
        }