public void TransformationTest() { var obj = MarkedComposite.Create(string.Empty, new[] { MarkedComposite.Create("inner composite", new[] { MarkedComposite.CreateValue("mark", new Simple { Number = 1, }), MarkedComposite.Create("inner composite level2", new[] { MarkedComposite.CreateValue("mark2", new Simple { Number = 2, }) }) }) }); var result = obj.EnsureHasContainer( "inner composite", "inner composite level2", (x, y) => x == y); Assert.Equal("[ ( inner composite )[ ( mark )1, ( inner composite level2 )[ ( mark2 )2 ] ] ]", result.ToStringShort()); result = obj.EnsureHasContainer( string.Empty, "inner composite2", (x, y) => x == y); Assert.Equal("[ ( inner composite )[ ( mark )1, ( inner composite level2 )[ ( mark2 )2 ] ], ( inner composite2 )[ ] ]", result.ToStringShort()); }
public void TransformationTest() { var obj = MarkedComposite.Create(string.Empty, new[] { MarkedComposite.Create("inner composite", new[] { MarkedComposite.CreateValue("mark", new Simple { Number = 1, }) }) }); var result = obj.SetValue( "inner composite", "mark", new Simple { Number = 2, }, (x, y) => x == y); Assert.Equal("[ ( inner composite )[ ( mark )2 ] ]", result.ToStringShort()); result = obj.SetValue( "inner composite", "mark2", new Simple { Number = 2, }, (x, y) => x == y); Assert.Equal("[ ( inner composite )[ ( mark )1, ( mark2 )2 ] ]", result.ToStringShort()); }
public void MarkedTransformationTest() { var inputComposite = MarkedComposite.Create(string.Empty, new[] { MarkedComposite.Create("inner composite", new[] { MarkedComposite.CreateValue("mark", new Simple { Number = 1, }) }) }); Assert.Equal("[ ( inner composite )[ ( mark )1 ] ]", inputComposite.ToStringShort()); }
public void MarkedTrivialParametersTest() { var inputComposite = MarkedComposite.Create(string.Empty, new Composite <string, int>[] {}); Assert.Equal("[ ]", inputComposite.ToStringShort()); inputComposite = MarkedComposite.Create("mark", new Composite <string, int>[] {}); Assert.Equal("( mark )[ ]", inputComposite.ToStringShort()); inputComposite = MarkedComposite.Create(string.Empty, new[] { MarkedComposite.CreateValue(string.Empty, 1) }); Assert.Equal("[ 1 ]", inputComposite.ToStringShort()); inputComposite = MarkedComposite.Create(string.Empty, new[] { MarkedComposite.CreateValue("mark", 1) }); Assert.Equal("[ ( mark )1 ]", inputComposite.ToStringShort()); inputComposite = MarkedComposite.CreateValue(string.Empty, 1); Assert.Equal("1", inputComposite.ToStringShort()); inputComposite = MarkedComposite.CreateValue("mark", 1); Assert.Equal("( mark )1", inputComposite.ToStringShort()); }