public void TestDeleteShapes() { //-------------Setup Test Pack ------------------ Shape shape = CreateSavedShape(); CircleNoPrimaryKey circle = CreateSavedCircle(); FilledCircleInheritsCircleNoPK filledCircle = CreateSavedFilledCircle(); //-------------Execute test --------------------- shape.MarkForDelete(); shape.Save(); circle.MarkForDelete(); circle.Save(); filledCircle.MarkForDelete(); filledCircle.Save(); //-------------Test Result ---------------------- BusinessObjectCollection <Shape> shapes = new BusinessObjectCollection <Shape>(); BusinessObjectCollection <CircleNoPrimaryKey> circles = new BusinessObjectCollection <CircleNoPrimaryKey>(); BusinessObjectCollection <FilledCircleInheritsCircleNoPK> filledCircles = new BusinessObjectCollection <FilledCircleInheritsCircleNoPK>(); shapes.LoadAll(); circles.LoadAll(); filledCircles.LoadAll(); Assert.AreEqual(0, shapes.Count); Assert.AreEqual(0, circles.Count); Assert.AreEqual(0, filledCircles.Count); }
protected static FilledCircleInheritsCircleNoPK CreateSavedFilledCircle() { FilledCircleInheritsCircleNoPK filledCircle = new FilledCircleInheritsCircleNoPK(); filledCircle.Colour = 3; filledCircle.Radius = 7; filledCircle.ShapeName = "FilledCircle"; filledCircle.Save(); return(filledCircle); }
public void TestLoadUpdatedShapes() { //-------------Setup Test Pack ------------------ Shape shape = CreateSavedShape(); CircleNoPrimaryKey circle = CreateSavedCircle(); FilledCircleInheritsCircleNoPK filledCircle = CreateSavedFilledCircle(); shape.ShapeName = "MyShapeChanged"; shape.Save(); circle.ShapeName = "CircleChanged"; circle.Radius = 10; circle.Save(); filledCircle.ShapeName = "FilledCircleChanged"; filledCircle.Radius = 12; filledCircle.Colour = 4; filledCircle.Save(); //-------------Execute test --------------------- BusinessObjectCollection <Shape> shapes = new BusinessObjectCollection <Shape>(); BusinessObjectCollection <CircleNoPrimaryKey> circles = new BusinessObjectCollection <CircleNoPrimaryKey>(); BusinessObjectCollection <FilledCircleInheritsCircleNoPK> filledCircles = new BusinessObjectCollection <FilledCircleInheritsCircleNoPK>(); shapes.LoadAll("ShapeName"); circles.LoadAll("ShapeName"); filledCircles.LoadAll("ShapeName"); //-------------Test Result ---------------------- Assert.AreEqual(3, shapes.Count); Assert.AreEqual("CircleChanged", shapes[0].ShapeName); Assert.AreEqual("FilledCircleChanged", shapes[1].ShapeName); Assert.AreEqual("MyShapeChanged", shapes[2].ShapeName); Assert.AreEqual(2, circles.Count); Assert.AreEqual(10, circles[0].Radius); Assert.AreEqual(12, circles[1].Radius); Assert.AreEqual("CircleChanged", circles[0].ShapeName); Assert.AreEqual("FilledCircleChanged", circles[1].ShapeName); Assert.AreEqual(1, filledCircles.Count); Assert.AreEqual(4, filledCircles[0].Colour); Assert.AreEqual(12, filledCircles[0].Radius); Assert.AreEqual("FilledCircleChanged", filledCircles[0].ShapeName); }
protected static FilledCircleInheritsCircleNoPK CreateSavedFilledCircle() { FilledCircleInheritsCircleNoPK filledCircle = new FilledCircleInheritsCircleNoPK(); filledCircle.Colour = 3; filledCircle.Radius = 7; filledCircle.ShapeName = "FilledCircle"; filledCircle.Save(); return filledCircle; }