private void GetConfText_CanRoundTripComplexDictedClass(bool multiline) { var subject = new ComplexDictedClass(); subject.Dict[0] = new ComplexClass(); subject.Dict[0].Child.StringProp = "hello"; subject.Dict[0].DoubleProp = 1.23; subject.Dict[0].StringProp = "world"; subject.Dict[1] = new ComplexClass(); subject.Dict[1].Child.StringProp = "HELLO"; subject.Dict[1].DoubleProp = 2.34; subject.Dict[1].StringProp = "WORLD"; var text = subject.GetConfText(); var conf = new ConfBlockFactory().CreateConfBlock(text, new TextContentsProvider()); var copy = conf.Configure(new ComplexDictedClass()); Assert.That(copy.Dict[0].Child.StringProp, Is.EqualTo(subject.Dict[0].Child.StringProp)); Assert.That(copy.Dict[0].DoubleProp, Is.EqualTo(subject.Dict[0].DoubleProp)); Assert.That(copy.Dict[0].StringProp, Is.EqualTo(subject.Dict[0].StringProp)); Assert.That(copy.Dict[1].Child.StringProp, Is.EqualTo(subject.Dict[1].Child.StringProp)); Assert.That(copy.Dict[1].DoubleProp, Is.EqualTo(subject.Dict[1].DoubleProp)); Assert.That(copy.Dict[1].StringProp, Is.EqualTo(subject.Dict[1].StringProp)); }
public void GetConfText_GetsComplexDictedClass() { var subject = new ComplexDictedClass(); subject.Dict[0] = new ComplexClass(); subject.Dict[0].Child.StringProp = "hello"; subject.Dict[0].DoubleProp = 1.23; subject.Dict[0].StringProp = "world"; subject.Dict[1] = new ComplexClass(); subject.Dict[1].Child.StringProp = "HELLO"; subject.Dict[1].DoubleProp = 2.34; subject.Dict[1].StringProp = "WORLD"; var actual = subject.GetConfText("subj"); var expected = string.Join(Environment.NewLine, "subj.Dict[0].Child.StringProp = hello", "subj.Dict[0].DoubleProp = 1.23", "subj.Dict[0].StringProp = world", "subj.Dict[1].Child.StringProp = HELLO", "subj.Dict[1].DoubleProp = 2.34", "subj.Dict[1].StringProp = WORLD"); Assert.That(actual, Is.EqualTo(expected)); }