public void GetConfText_GetsComplexTextOnSingleLineWithEmptyKey() { var subject = new ComplexClass(); subject.StringProp = "mystr"; subject.DoubleProp = 4.321; subject.Child.StringProp = "My other str"; var actual = subject.GetConfText(key: "", multiline: false); var expected = "Child.StringProp=My other str;DoubleProp=4.321;StringProp=mystr"; Assert.That(actual, Is.EqualTo(expected)); }
public void GetConfText_CanRoundTripComplexClassMultiline() { var expected = new ComplexClass(); expected.StringProp = string.Join(Environment.NewLine, "mystr", "on", "", "multiple", "lines"); expected.DoubleProp = 4.321; expected.Child.StringProp = "My other str"; var text = expected.GetConfText(); var conf = new ConfBlockFactory().CreateConfBlock(text, new TextContentsProvider()); var actual = conf.Configure(new ComplexClass()); Assert.That(actual.StringProp, Is.EqualTo(expected.StringProp)); }
private static void GetConfText_CanRoundTripComplexClass(Action <ComplexClass, ComplexClass> assert) { var expected = new ComplexClass(); expected.StringProp = "mystr"; expected.DoubleProp = 4.321; expected.Child.StringProp = "My other str"; var text = expected.GetConfText(); var conf = new ConfBlockFactory().CreateConfBlock(text, new TextContentsProvider()); var actual = conf.Configure(new ComplexClass()); assert(actual, expected); }
public void GetConfText_GetsComplexTextOnSingleLine() { var subject = new ComplexClass(); subject.StringProp = "mystr"; subject.DoubleProp = 4.321; subject.Child.StringProp = "My other str"; var actual = subject.GetConfText(multiline: false); var expected = string.Join(";", "ComplexClass.Child.StringProp=My other str", "ComplexClass.DoubleProp=4.321", "ComplexClass.StringProp=mystr"); Assert.That(actual, Is.EqualTo(expected)); }
public void GetConfText_GetsComplexText() { var subject = new ComplexClass(); subject.StringProp = "mystr"; subject.DoubleProp = 4.321; subject.Child.StringProp = "My other str"; var actual = subject.GetConfText(); var expected = string.Join(Environment.NewLine, "ComplexClass.Child.StringProp = My other str", "ComplexClass.DoubleProp = 4.321", "ComplexClass.StringProp = mystr"); Assert.That(actual, Is.EqualTo(expected)); }