Beispiel #1
0
        public void ListSecurityGroups()
        {
            using (var httpTest = new HttpTest())
            {
                Identifier        securityGroupId     = Guid.NewGuid();
                Identifier        securityGroupRuleId = Guid.NewGuid();
                SecurityGroupRule rule = new SecurityGroupRule {
                    Id = securityGroupRuleId
                };
                List <SecurityGroupRule> rules = new List <SecurityGroupRule> {
                    rule
                };

                httpTest.RespondWithJson(new SecurityGroupCollection
                {
                    new SecurityGroup {
                        Id = securityGroupId, SecurityGroupRules = rules
                    }
                });

                var results = _networking.ListSecurityGroups();

                httpTest.ShouldHaveCalled("*/security-groups");
                Assert.Equal(1, results.Count());
                var result     = results.First();
                var resultRule = result.SecurityGroupRules.First();
                Assert.Equal(securityGroupId, result.Id);
                Assert.Equal(rule.Id, resultRule.Id);
            }
        }