Ejemplo n.º 1
0
                public void Rejects_Null_Properties()
                {
                    var properties = new [] { "Property30" };
                    var target     = new SimpleClass {
                        Property1 = "Property1", Property2 = 32
                    };

                    Assert.Throws <DirectDebitException>(
                        () => Sugar.ComposeLine <SimpleClass>(SerializeMethod.FixedWidth,
                                                              properties, target));
                }
Ejemplo n.º 2
0
                public void Generate_Blank_Entries()
                {
                    var properties = new [] { "Property1", "Blank", "Property2" };
                    var target     = new SimpleClass {
                        Property1 = "Property1", Property2 = 32
                    };

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

                    Assert.Equal("Property1,,32", line);
                }
Ejemplo n.º 3
0
                public void Escapes_Commas()
                {
                    var properties = new [] { "Property1", "Property2" };
                    var target     = new SimpleClass {
                        Property1 = "Proper,ty1", Property2 = 32
                    };

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

                    Assert.Equal("\"Proper,ty1\",32", line);
                }
Ejemplo n.º 4
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);
                }
Ejemplo n.º 5
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);
                }
Ejemplo n.º 6
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);
                }