コード例 #1
1
    public static void TestPlaneConstructor()
    {
        PlaneAttributes atts = new PlaneAttributes("badger50", 1, 5, 3, 7, 2000);
        Plane p = new Plane("acas-1200-badger50", atts);

        //A plane should have anything assigned to it in the constructor reflected in it immediately.
        p.attributes.maxHeight.ShouldBe(2000);
        p.attributes.planeModelGUID.ShouldBe("badger50");
        p.attributes.planeHeight.ShouldBe(3);
        p.attributes.planeWidth.ShouldBe(5);
        p.attributes.planeLength.ShouldBe(7);
        p.attributes.planeClass.ShouldBe(1);

        //A new plane should have no position data within it.
        p.GetPositionCount().ShouldBe(0);

        //A new plane with no position data should have a 'zero' velocity
        p.IsClass(p.attributes.planeClass).ShouldBe(true);
        Vector3d vel = p.GetVelocity();
        vel.x.ShouldBe(0, .01);
        vel.y.ShouldBe(0, .01);
        vel.z.ShouldBe(0, .01);

        //Getting position from a newly constructed plane (with no position data)
        //should cause a NotSupportedException
        Exception ex = null;
        try {
            Vector3d pos = p.GetPosition();
        } catch (Exception e) {
            ex = e;
        }
        ex.ShouldNotBeNull();
        ex.GetType().ShouldBe(typeof(NotSupportedException));
    }