public void ValidateOptionsWithEmptyProjectId()
        {
            var deliveryOptions = new Delivery.DeliveryOptions {
                ProjectId = ""
            };

            Assert.Throws <ArgumentException>(() => deliveryOptions.Validate());
        }
        public void ValidateOptionsWithNullProjectId()
        {
            var deliveryOptions = new Delivery.DeliveryOptions {
                ProjectId = null
            };

            Assert.Throws <ArgumentNullException>(() => deliveryOptions.Validate());
        }
Esempio n. 3
0
        public IOptionalClientSetup BuildWithDeliveryOptions(Func <IDeliveryOptionsBuilder, Delivery.DeliveryOptions> buildDeliveryOptions)
        {
            var builder = DeliveryOptionsBuilder.CreateInstance();

            _deliveryOptions = buildDeliveryOptions(builder);

            return(this);
        }
        public void ValidateOptionsWithEmptyGuidProjectId(string projectId)
        {
            var deliveryOptions = new Delivery.DeliveryOptions {
                ProjectId = projectId
            };

            Assert.Throws <ArgumentException>(() => deliveryOptions.Validate());
        }
        public void ValidateOptionsWithEnabledSecuredApiWithSetKey()
        {
            var deliveryOptions = new Delivery.DeliveryOptions
            {
                ProjectId = _guid.ToString(),
                UseSecuredProductionApi = true
            };

            Assert.Throws <InvalidOperationException>(() => deliveryOptions.Validate());
        }
        public void ValidateOptionsWithNegativeMaxRetryAttempts()
        {
            var deliveryOptions = new Delivery.DeliveryOptions
            {
                ProjectId        = _guid.ToString(),
                MaxRetryAttempts = -10
            };

            Assert.Throws <ArgumentException>(() => deliveryOptions.Validate());
        }
        public void ValidateNullRetryOptions_Throws()
        {
            var deliveryOptions = new Delivery.DeliveryOptions
            {
                ProjectId = _guid.ToString(),
                DefaultRetryPolicyOptions = null
            };

            Assert.Throws <ArgumentNullException>(() => deliveryOptions.Validate());
        }
        public void ValidateRetryOptions_ZeroMaxCumulativeWaitTime_Throws()
        {
            var deliveryOptions = new Delivery.DeliveryOptions
            {
                ProjectId = _guid.ToString(),
                DefaultRetryPolicyOptions = new DefaultRetryPolicyOptions
                {
                    MaxCumulativeWaitTime = TimeSpan.Zero
                }
            };

            Assert.Throws <ArgumentException>(() => deliveryOptions.Validate());
        }
        public void ValidateRetryOptions_ZeroDeltaBackoff_Throws()
        {
            var deliveryOptions = new Delivery.DeliveryOptions
            {
                ProjectId = _guid.ToString(),
                DefaultRetryPolicyOptions = new DefaultRetryPolicyOptions
                {
                    DeltaBackoff = TimeSpan.Zero
                }
            };

            Assert.Throws <ArgumentException>(() => deliveryOptions.Validate());
        }
        public void ValidateOptionsUseOfPreviewAndProductionApiSimultaneously()
        {
            const string previewApiKey    = "previewApiKey";
            const string productionApiKey = "productionApiKey";

            var deliveryOptions = new Delivery.DeliveryOptions
            {
                ProjectId               = _guid.ToString(),
                UsePreviewApi           = true,
                PreviewApiKey           = previewApiKey,
                UseSecuredProductionApi = true,
                SecuredProductionApiKey = productionApiKey
            };

            Assert.Throws <InvalidOperationException>(() => deliveryOptions.Validate());
        }