Example #1
0
 public void Setup()
 {
     _policyResult           = null;
     _policyDefinition       = null;
     _policyCollectionResult = null;
     _updatedPolicyName      = null;
 }
Example #2
0
        private void When_I_Create_A_New_Policy()
        {
            _policyDefinition = new AntiAffinityPolicyDefinition
            {
                Name     = "new policy",
                Location = "CA3"
            };

            _policyResult = ServiceFactory.CreateAntiAffinityPolicyService().Create(_policyDefinition, CancellationToken.None).Result;
        }
        public void Create_PerformsCorrectRequest()
        {
            var expectedUri   = String.Format("antiaffinitypolicies/{0}", AccountAlias);
            var expectedBody  = new AntiAffinityPolicyDefinition();
            var expectedToken = new CancellationTokenSource().Token;

            _client.Setup(x => x.PostAsync <AntiAffinityPolicy>(expectedUri, expectedBody, expectedToken))
            .Returns(Task.FromResult(new AntiAffinityPolicy()));

            _testObject.Create(expectedBody, expectedToken).Wait();

            _client.VerifyAll();
        }
Example #4
0
        public async Task <AntiAffinityPolicy> Create(AntiAffinityPolicyDefinition definition, CancellationToken cancellationToken = new CancellationToken())
        {
            var requestUri = await GetUri(cancellationToken);

            return(await _httpClient.PostAsync <AntiAffinityPolicy>(requestUri, definition, cancellationToken));
        }