예제 #1
0
                public void Takes_Properties()
                {
                    var properties = new [] { "Property1", "Property2" };
                    var target = new SimpleClass { Property1 = "Property1", Property2 = 32 };

                    var line = Sugar.ComposeLine<SimpleClass>(SerializeMethod.CSV,
                            properties, target);

                    Assert.Equal("Property1,32", line);
                }
예제 #2
0
                public void Ignores_Case()
                {
                    var properties = new [] { "PROPERTY1" };
                    var target = new SimpleClass { Property1 = "Property1", Property2 = 32 };

                    var line = Sugar.ComposeLine<SimpleClass>(SerializeMethod.FixedWidth,
                            properties, target);

                    Assert.Equal("Property1", line);
                }
예제 #3
0
                public void Inner_Properties()
                {
                    var properties = new [] { "Property3.Property1" };
                    var target = new SimpleClass { Property1 = "Property1", Property2 = 32,
                        Property3 = new InnerClass { Property1 = "Property3" } };

                    var line = Sugar.ComposeLine<SimpleClass>(SerializeMethod.CSV,
                            properties, target);

                    Assert.Equal("Property3", line);
                }
예제 #4
0
                public void Rejects_Line()
                {
                    var properties = new [] { "Line" };
                    var target = new SimpleClass { Property1 = "Property1", Property2 = 32 };

                    Assert.Throws<DirectDebitException>(
                            () => Sugar.ComposeLine<SimpleClass>(SerializeMethod.FixedWidth,
                                                                 properties, target));
                }
예제 #5
0
                public void Properties_Are_Ordered()
                {
                    var properties = new [] { "Property2", "Property1" };
                    var target = new SimpleClass { Property1 = "Property1", Property2 = 32 };

                    var line = Sugar.ComposeLine<SimpleClass>(SerializeMethod.FixedWidth,
                            properties, target);

                    Assert.Equal("32Property1", line);
                }