Ejemplo n.º 1
0
        public void AddArrayOutput_WithListOfValueMappings_ShouldAddArrayOutputValueContainingListOfObjectOutputValuesToOutputsProperty()
        {
            // Arrange
            var template    = new TestTemplate();
            var key         = "key";
            var nestedKey   = "nestedKey";
            var nestedValue = "nestedValue";
            var mapping     = new Dictionary <string, string> {
                { nestedKey, nestedValue }
            };

            // Act
            template.AddArrayOutput(key, new[] { mapping });

            // Assert
            template.Outputs.Should().HaveCount(1);
            template.Outputs.First().Key.Should().Be(key);
            template.Outputs.First().Value.Should().BeOfType <ArrayOutputValue>();
            template.Outputs.First().Value.HasValue.Should().BeTrue();
            template.Outputs.First().Value.As <ArrayOutputValue>().Value.Should().BeOfType <List <OutputValue> >();
            template.Outputs.First()
            .Value.As <ArrayOutputValue>()
            .Value.First().As <ObjectOutputValue>()
            .Value[nestedKey].As <StringOutputValue>()
            .Value.Should().Be(nestedValue);
        }
Ejemplo n.º 2
0
        public void AddArrayOutput_WithListOfValues_ShouldAddArrayOutputValueContainingListOfStringOutputValuesToOutputsProperty()
        {
            // Arrange
            var template = new TestTemplate();
            var key      = "key";
            var value    = "value";

            // Act
            template.AddArrayOutput(key, new List <string> {
                value
            });

            // Assert
            template.Outputs.Should().HaveCount(1);
            template.Outputs.First().Key.Should().Be(key);
            template.Outputs.First().Value.Should().BeOfType <ArrayOutputValue>();
            template.Outputs.First().Value.HasValue.Should().BeTrue();
            template.Outputs.First().Value.As <ArrayOutputValue>().Value.Should().BeOfType <List <OutputValue> >();
            template.Outputs.First()
            .Value.As <ArrayOutputValue>()
            .Value.First().As <StringOutputValue>()
            .Value.Should().Be(value);
        }