本文整理汇总了C#中Circle.MarkForDelete方法的典型用法代码示例。如果您正苦于以下问题:C# Circle.MarkForDelete方法的具体用法?C# Circle.MarkForDelete怎么用?C# Circle.MarkForDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Circle
的用法示例。
在下文中一共展示了Circle.MarkForDelete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestDatabaseReadWrite
public void TestDatabaseReadWrite()
{
// Test inserting & selecting
Shape shape = new Shape();
shape.ShapeName = "MyShape";
shape.Save();
BusinessObjectCollection<Shape> shapes = new BusinessObjectCollection<Shape>();
shapes.LoadAll();
Assert.AreEqual(1, shapes.Count);
BusinessObjectCollection<Circle> circles = new BusinessObjectCollection<Circle>();
circles.LoadAll();
Assert.AreEqual(0, circles.Count);
Circle circle = new Circle();
circle.Radius = 5;
circle.ShapeName = "Circle";
circle.Save();
shapes.LoadAll("ShapeName");
Assert.AreEqual(2, shapes.Count);
Assert.AreEqual("Circle", shapes[0].ShapeName);
Assert.AreEqual("MyShape", shapes[1].ShapeName);
circles.LoadAll();
Assert.AreEqual(1, circles.Count);
Assert.AreEqual(circles[0].CircleID, shapes[0].ShapeID);
Assert.AreEqual(circles[0].ShapeID, shapes[0].ShapeID); //still gets inherited
Assert.AreEqual(5, circles[0].Radius);
Assert.AreEqual("Circle", circles[0].ShapeName);
// Test updating
shape.ShapeName = "MyShapeChanged";
shape.Save();
circle.ShapeName = "CircleChanged";
circle.Radius = 10;
circle.Save();
shapes.LoadAll("ShapeName");
Assert.AreEqual("CircleChanged", shapes[0].ShapeName);
Assert.AreEqual("MyShapeChanged", shapes[1].ShapeName);
circles.LoadAll();
Assert.AreEqual(10, circles[0].Radius);
Assert.AreEqual("CircleChanged", circles[0].ShapeName);
// Test deleting
shape.MarkForDelete();
shape.Save();
circle.MarkForDelete();
circle.Save();
shapes.LoadAll();
Assert.AreEqual(0, shapes.Count);
circles.LoadAll();
Assert.AreEqual(0, circles.Count);
}
示例2: TestDatabaseReadWrite
public void TestDatabaseReadWrite()
{
// Test inserting & selecting
Shape shape = new Shape();
shape.ShapeName = "MyShape";
shape.Save();
BusinessObjectCollection<Shape> shapes = new BusinessObjectCollection<Shape>();
shapes.LoadAll();
Assert.AreEqual(1, shapes.Count);
BusinessObjectCollection<Circle> circles = new BusinessObjectCollection<Circle>();
circles.LoadAll();
Assert.AreEqual(0, circles.Count);
BusinessObjectCollection<FilledCircle> filledCircles = new BusinessObjectCollection<FilledCircle>();
filledCircles.LoadAll();
Assert.AreEqual(0, filledCircles.Count);
Circle circle = new Circle();
circle.Radius = 5;
circle.ShapeName = "Circle";
circle.Save();
shapes.LoadAll("ShapeName");
Assert.AreEqual(2, shapes.Count);
Assert.AreEqual("Circle", shapes[0].ShapeName);
Assert.AreEqual("MyShape", shapes[1].ShapeName);
circles.LoadAll("ShapeName");
Assert.AreEqual(1, circles.Count);
Assert.AreEqual(circles[0].ShapeID, shapes[0].ShapeID);
Assert.AreEqual(5, circles[0].Radius);
Assert.AreEqual("Circle", circles[0].ShapeName);
FilledCircle filledCircle = new FilledCircle();
filledCircle.Colour = 3;
filledCircle.Radius = 7;
filledCircle.ShapeName = "FilledCircle";
filledCircle.Save();
shapes.LoadAll("ShapeName");
Assert.AreEqual(3, shapes.Count);
Assert.AreEqual("Circle", shapes[0].ShapeName);
Assert.AreEqual("FilledCircle", shapes[1].ShapeName);
Assert.AreEqual("MyShape", shapes[2].ShapeName);
circles.LoadAll("ShapeName");
Assert.AreEqual(2, circles.Count);
Assert.AreEqual(circles[0].ShapeID, shapes[0].ShapeID);
Assert.AreEqual(7, circles[1].Radius);
Assert.AreEqual("FilledCircle", circles[1].ShapeName);
filledCircles.LoadAll();
Assert.AreEqual(1, filledCircles.Count);
Assert.AreEqual(filledCircles[0].ShapeID, shapes[1].ShapeID);
Assert.AreEqual(7, filledCircles[0].Radius);
Assert.AreEqual("FilledCircle", filledCircles[0].ShapeName);
Assert.AreEqual(3, filledCircles[0].Colour);
// Test updating
shape.ShapeName = "MyShapeChanged";
shape.Save();
circle.ShapeName = "CircleChanged";
circle.Radius = 10;
circle.Save();
filledCircle.ShapeName = "FilledCircleChanged";
filledCircle.Radius = 12;
filledCircle.Colour = 4;
filledCircle.Save();
shapes.LoadAll("ShapeName");
Assert.AreEqual("CircleChanged", shapes[0].ShapeName);
Assert.AreEqual("FilledCircleChanged", shapes[1].ShapeName);
Assert.AreEqual("MyShapeChanged", shapes[2].ShapeName);
circles.LoadAll("ShapeName");
Assert.AreEqual(10, circles[0].Radius);
Assert.AreEqual(12, circles[1].Radius);
Assert.AreEqual("CircleChanged", circles[0].ShapeName);
Assert.AreEqual("FilledCircleChanged", circles[1].ShapeName);
filledCircles.LoadAll();
Assert.AreEqual(4, filledCircles[0].Colour);
Assert.AreEqual(12, filledCircles[0].Radius);
Assert.AreEqual("FilledCircleChanged", filledCircles[0].ShapeName);
// Test deleting
shape.MarkForDelete();
shape.Save();
circle.MarkForDelete();
circle.Save();
filledCircle.MarkForDelete();
filledCircle.Save();
shapes.LoadAll();
Assert.AreEqual(0, shapes.Count);
circles.LoadAll();
Assert.AreEqual(0, circles.Count);
filledCircles.LoadAll();
Assert.AreEqual(0, filledCircles.Count);
//.........这里部分代码省略.........