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

            // Act
            template.AddObjectOutput(key, mapping);

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

            // Act
            template.AddObjectOutput(key, value);

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