public async Task GetAntiAffinityRulesForServer_ReturnsResponse()
        {
            var serverId = Guid.NewGuid();

            requestsAndResponses.Add(ApiUris.MyAccount, RequestFileResponseType.AsGoodResponse("GetMyAccountDetails.xml"));
            requestsAndResponses.Add(ApiUris.GetMcp2GetAntiAffinityRulesForServer(accountId, serverId), RequestFileResponseType.AsGoodResponse("GetAntiAffinityRulesResponse.xml"));

            var client   = GetWebApiClient();
            var accessor = new AntiAffinityRuleAccessor(client);
            var response = await accessor.GetAntiAffinityRulesForServer(serverId);

            Assert.IsNotNull(response);
            Assert.AreEqual(1, response.Count());
            Assert.AreEqual(2, response.First().serverSummary.Count());
            Assert.AreEqual("681a6db2-9c7c-4d98-a0c4-7b3d7c1619ba", response.First().serverSummary.First().id);
            Assert.AreEqual("5783e93f-5370-44fc-a772-cd3c29a2ecaa", response.First().serverSummary.Last().id);
        }
Ejemplo n.º 2
0
        public async Task GetAntiAffinityRulesForServer_ReturnsResponse()
        {
            var serverId = Guid.NewGuid();

            requestsAndResponses.Add(ApiUris.MyAccount, RequestFileResponseType.AsGoodResponse("GetMyAccountDetails.xml"));
            requestsAndResponses.Add(ApiUris.GetMcp2GetAntiAffinityRulesForServer(accountId, serverId), RequestFileResponseType.AsGoodResponse("GetAntiAffinityRulesResponse.xml"));

            var client   = GetWebApiClient();
            var accessor = new AntiAffinityRuleAccessor(client);
            var response = await accessor.GetAntiAffinityRulesForServer(serverId);

            Assert.IsNotNull(response);
            Assert.AreEqual(1, response.Count());
            Assert.AreEqual(2, response.First().server.Count());
            Assert.AreEqual("9c5ea62d-9750-4130-a955-039c5ac9762c", response.First().server.First().id);
            Assert.AreEqual("fe2e74c0-55c6-4a0b-8ab4-2b8342d997b5", response.First().server.Last().id);
        }