public void ThreeLinkedGraph_json() { var cfg = ConfigurationHelper.GetStandardConfiguration(); cfg.OutputFormatter = new JsonStyle(cfg.IndentIncrement); var printer = new StatePrinter(cfg); var car = new Car(new SteeringWheel(new FoamGrip("Plastic"))); car.Brand = "Toyota"; var expected = @" { ""StereoAmplifiers"" : null, ""steeringWheel"" : { ""Size"" : 3, ""Grip"" : { ""Material"" : ""Plastic"" } ""Weight"" : 525 } ""Brand"" : ""Toyota"" } "; Assert.AreEqual(expected, printer.PrintObject(car)); }
public void ThreeLinkedGraph() { var car = new Car(new SteeringWheel(new FoamGrip("Plastic"))); car.Brand = "Toyota"; var expected = @"new Car() { StereoAmplifiers = null steeringWheel = new SteeringWheel() { Size = 3 Grip = new FoamGrip() { Material = ""Plastic"" } Weight = 525 } Brand = ""Toyota"" } "; Assert.AreEqual(expected, printer.PrintObject(car)); }
public void ThreeLinkedGraph_xmlstyle() { var cfg = ConfigurationHelper.GetStandardConfiguration(); cfg.OutputFormatter = new XmlStyle(cfg.IndentIncrement); var printer = new StatePrinter(cfg); var car = new Car(new SteeringWheel(new FoamGrip("Plastic"))); car.Brand = "Toyota"; var expected = @"<ROOT type='Car'> <StereoAmplifiers>null</StereoAmplifiers> <steeringWheel type='SteeringWheel'> <Size>3</Size> <Grip type='FoamGrip'> <Material>""Plastic""</Material> </Grip> <Weight>525</Weight> </steeringWheel> <Brand>""Toyota""</Brand> </ROOT> "; Assert.AreEqual(expected, printer.PrintObject(car)); }
public void Setup() { printer = TestHelper.CreateTestPrinter(); car = new Car(new SteeringWheel(new FoamGrip("Plastic"))) { Brand = "Toyota" }; course = new Course(); course.Members.Add(new Student("Stan", course)); course.Members.Add(new Student("Richy", course)); }