Ejemplo n.º 1
0
        public void Probe_True()
        {
            // Arrange
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();
            var environment     = new EC2Environment(configuration, resourceFetcher);

            // Act
            var result = environment.Probe();

            // Assert
            Assert.True(result);
        }
Ejemplo n.º 2
0
        public void Type_Configuration_NotSet()
        {
            // Arrange
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();
            var environment     = new EC2Environment(configuration, resourceFetcher);

            // Act
            var typeName = environment.Type;

            // Assert
            Assert.False(string.IsNullOrWhiteSpace(typeName));
        }
Ejemplo n.º 3
0
        public void LogStreamName_Configuration_NotSet()
        {
            // Arrange
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();
            var environment     = new EC2Environment(configuration, resourceFetcher);

            // Act
            var streamName = environment.LogStreamName;

            // Assert
            Assert.Equal(string.Empty, streamName);
        }
Ejemplo n.º 4
0
        public void Probe_False()
        {
            // Arrange
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();

            resourceFetcher.Fetch <EC2Metadata>(Arg.Any <Uri>()).Throws <EMFClientException>();
            var environment = new EC2Environment(configuration, resourceFetcher);

            // Act
            var result = environment.Probe();

            // Assert
            Assert.False(result);
        }
Ejemplo n.º 5
0
        public void LogStreamName_Configuration_Set()
        {
            // Arrange
            var logStreamName   = "TestServiceType";
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();

            configuration.LogStreamName.Returns(logStreamName);
            var environment = new EC2Environment(configuration, resourceFetcher);

            // Act
            var streamName = environment.LogStreamName;

            // Assert
            Assert.Equal(logStreamName, streamName);
        }
Ejemplo n.º 6
0
        public void Type_Configuration_Set()
        {
            // Arrange
            var type            = "TestServiceType";
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();

            configuration.ServiceType = type;
            var environment = new EC2Environment(configuration, resourceFetcher);

            // Act
            var typeName = environment.Type;

            // Assert
            Assert.Equal(type, typeName);
        }
Ejemplo n.º 7
0
        public void Name_Configuration_Set()
        {
            // Arrange
            var name            = "TestService";
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();

            configuration.ServiceName = name;
            var environment = new EC2Environment(configuration, resourceFetcher);

            // Act
            var environmentName = environment.Name;

            // Assert
            Assert.Equal(name, environmentName);
        }
Ejemplo n.º 8
0
        public void LogGroupName_Configuration_Set()
        {
            // Arrange
            var logGroupName    = "TestLogGroup";
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();

            configuration.LogGroupName = logGroupName;
            var environment = new EC2Environment(configuration, resourceFetcher);

            // Act
            var groupName = environment.LogGroupName;

            // Assert
            Assert.Equal(logGroupName, groupName);
        }
Ejemplo n.º 9
0
        public void Type_WithMetadata()
        {
            // Arrange
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();

            resourceFetcher.Fetch <EC2Metadata>(Arg.Any <Uri>()).Returns(new EC2Metadata());
            var environment = new EC2Environment(configuration, resourceFetcher);

            environment.Probe();

            // Act
            var result = environment.Type;

            // Assert
            Assert.Equal("AWS::EC2::Instance", result);
        }
Ejemplo n.º 10
0
        public void Type_WhenNoMetadata()
        {
            // Arrange
            var configuration   = _fixture.Create <IConfiguration>();
            var resourceFetcher = _fixture.Create <IResourceFetcher>();

            resourceFetcher.Fetch <EC2Metadata>(Arg.Any <Uri>()).Throws <EMFClientException>();
            var environment = new EC2Environment(configuration, resourceFetcher);

            environment.Probe();

            // Act
            var result = environment.Type;

            // Assert
            Assert.Equal(Constants.UNKNOWN, result);
        }