예제 #1
0
        public async Task GetResourcesAsync_MultiplePages_AllFetchedAndReturned()
        {
            // arrange
            var firstPage = new DescribeAutoScalingGroupsResponse
            {
                AutoScalingGroups = new List <AutoScalingGroup> {
                    new AutoScalingGroup {
                        AutoScalingGroupName = "Asg1"
                    }
                }
            };

            var secondPage = new DescribeAutoScalingGroupsResponse
            {
                AutoScalingGroups = new List <AutoScalingGroup> {
                    new AutoScalingGroup {
                        AutoScalingGroupName = "Asg2"
                    }
                }
            };

            var client = CreateAutoScalingClientStub(firstPage, secondPage);

            // act
            var sut    = new AutoScalingGroupSource(client);
            var result = await sut.GetResourceNamesAsync();

            // assert
            Assert.That(result.Count, Is.EqualTo(2));
            Assert.That(result.First(), Is.EqualTo(firstPage.AutoScalingGroups.Single().AutoScalingGroupName));
            Assert.That(result.Skip(1).First(), Is.EqualTo(secondPage.AutoScalingGroups.Single().AutoScalingGroupName));
        }
예제 #2
0
        public async Task GetResourcesAsync_EmptyResult_EmptyListReturned()
        {
            // arrange
            var firstPage = new DescribeAutoScalingGroupsResponse
            {
                AutoScalingGroups = new List <AutoScalingGroup>()
            };

            var client = CreateAutoScalingClientStub(firstPage);

            // act
            var sut    = new AutoScalingGroupSource(client);
            var result = await sut.GetResourceNamesAsync();

            // assert
            Assert.That(result.Count, Is.EqualTo(0));
        }