Beispiel #1
0
        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));
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
        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));
        }