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); }
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); }
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); }
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)); }
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); }