public void ValidateOptionsWithNullProjectId()
        {
            var deliveryOptions = new DeliveryOptions {
                ProjectId = null
            };

            Assert.Throws <ArgumentNullException>(() => deliveryOptions.Validate());
        }
        public void ValidateOptionsWithEmptyGuidProjectId(string projectId)
        {
            var deliveryOptions = new DeliveryOptions {
                ProjectId = projectId
            };

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

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

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

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

            Assert.Throws <ArgumentException>(() => deliveryOptions.Validate());
        }
        public void ValidateRetryOptions_ZeroDeltaBackoff_Throws()
        {
            var deliveryOptions = new 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 DeliveryOptions
            {
                ProjectId          = _guid.ToString(),
                UsePreviewApi      = true,
                PreviewApiKey      = previewApiKey,
                UseSecureAccess    = true,
                SecureAccessApiKey = productionApiKey
            };

            Assert.Throws <InvalidOperationException>(() => deliveryOptions.Validate());
        }
コード例 #9
0
        DeliveryOptions IDeliveryOptionsBuild.Build()
        {
            _deliveryOptions.Validate();

            return(_deliveryOptions);
        }