public async Task DescribeRouteTablesAsync_when_any_exist_should_describe_route_tables()
        {
            // Arrange
            var client = new EnvironmentVariables().CloudComputeClient();
            IRouteTableService classUnderTest = new RouteTableService(client);

            // Act
            var response = await classUnderTest.DescribeRouteTablesAsync();

            // Assert
            Assert.IsTrue(response.RouteTables != null);
            Assert.IsTrue(response.RouteTables.Count >= 1);
        }
Example #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            // appsettings.json
            var awsAccessKeyId     = Configuration.GetSection("AwsAccessKeyId").Value;
            var awsSecretAccessKey = Configuration.GetSection("AwsSecretAccessKey").Value;
            var keyService         = new KeyService(awsAccessKeyId, awsSecretAccessKey);

            // Amazon clients
            // `keyService` can be used to pass `AwsAccessKeyId` and `AwsSecretAccessKey`
            var cloudComputeClient      = new AmazonEC2Client();
            var containerServiceClient  = new AmazonECSClient();
            var containerRegistryClient = new AmazonECRClient();

            services.AddSingleton <IKeyService>(keyService);
            services.AddSingleton <IAmazonEC2>(cloudComputeClient);
            services.AddSingleton <IAmazonECS>(containerServiceClient);
            services.AddSingleton <IAmazonECR>(containerRegistryClient);

            // AwsAdmin.Application Services
            var vpcService             = new VpcService(cloudComputeClient);
            var subnetService          = new SubnetService(cloudComputeClient);
            var routeTableService      = new RouteTableService(cloudComputeClient);
            var internetGatewayService = new InternetGatewayService(cloudComputeClient);
            var dhcpOptionsSetService  = new DhcpOptionsSetService(cloudComputeClient);
            var networkAclsService     = new NetworkAclsService(cloudComputeClient);
            var securityGroupService   = new SecurityGroupService(cloudComputeClient);

            services.AddSingleton <IVpcService>(vpcService);
            services.AddSingleton <ISubnetService>(subnetService);
            services.AddSingleton <IRouteTableService>(routeTableService);
            services.AddSingleton <IInternetGatewayService>(internetGatewayService);
            services.AddSingleton <IDhcpOptionsSetService>(dhcpOptionsSetService);
            services.AddSingleton <INetworkAclsService>(networkAclsService);
            services.AddSingleton <ISecurityGroupService>(securityGroupService);

            // Mappers
            services.AddSingleton <IDescribeVpcMapper, DescribeVpcMapper>();
            services.AddSingleton <IDescribeSubnetMapper, DescribeSubnetMapper>();
            services.AddSingleton <IDescribeRouteTableMapper, DescribeRouteTableMapper>();
            services.AddSingleton <IDhcpOptionsSetsMapper, DhcpOptionsSetsMapper>();
            services.AddSingleton <IInternetGatewayMapper, InternetGatewayMapper>();
            services.AddSingleton <INetworkAclsMapper, NetworkAclsMapper>();
            services.AddSingleton <ISecurityGroupMapper, SecurityGroupMapper>();
        }