Exemplo n.º 1
0
        public void DeserializeObjectsYaml()
        {
            var actual = PipelineReceiverActions.ConvertFromYaml(GetYamlContent(), PipelineReceiverActions.PassThru).ToArray();

            Assert.Equal(2, actual.Length);
            Assert.Equal("TestObject1", actual[0].Properties["targetName"].Value);
            Assert.Equal("Test", actual[0].PropertyValue <PSObject>("spec").PropertyValue <PSObject>("properties").PropertyValue <string>("kind"));
            Assert.Equal(2, actual[1].PropertyValue <PSObject>("spec").PropertyValue <PSObject>("properties").PropertyValue <int>("value2"));
            Assert.Equal(2, actual[1].PropertyValue <PSObject>("spec").PropertyValue <PSObject>("properties").PropertyValue <PSObject[]>("array").Length);
        }
Exemplo n.º 2
0
        public void UseObjectPath()
        {
            var actual = PipelineReceiverActions.ConvertFromYaml(GetYamlContent(),
                                                                 (sourceObject) => PipelineReceiverActions.ReadObjectPath(sourceObject, PipelineReceiverActions.PassThru, "items", true)
                                                                 ).ToArray();

            Assert.Equal(2, actual.Length);
            Assert.Equal("TestObject1", actual[0].Properties["targetName"].Value);
            Assert.Equal("Test", actual[0].PropertyValue <PSObject>("spec").PropertyValue <PSObject>("properties").PropertyValue <string>("kind"));
            Assert.Equal(2, actual[1].PropertyValue <PSObject>("spec").PropertyValue <PSObject>("properties").PropertyValue <int>("value2"));
        }