コード例 #1
0
        public void RequestByXAndY()
        {
            LandingControl control = new LandingControl();

            Assert.AreEqual(Response.OK_FOR_LANDING, control.LandingRequest(5, 5));

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(1, 1));

            Assert.AreEqual(Response.CLASH, control.LandingRequest(1, 1));
        }
コード例 #2
0
        public void RequestPreviouslyChecked()
        {
            LandingControl control = new LandingControl();

            Coordinate rocket01 = new Coordinate(16, 5);

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(rocket01));

            Coordinate rocket02 = new Coordinate(16, 5);

            Assert.AreEqual(Response.CLASH, control.LandingRequest(rocket02));
        }
コード例 #3
0
        public void RequestSomewhereInArea()
        {
            LandingControl control = new LandingControl();

            Coordinate rocket02 = new Coordinate(4, 5);

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(rocket02));

            Coordinate rocket03 = new Coordinate(16, 5);

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(rocket03));
        }
コード例 #4
0
        public void RequestOutButNearPlatform()
        {
            LandingControl control = new LandingControl();

            Coordinate rocket01 = new Coordinate(4, 5);

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(rocket01));

            Coordinate rocket02 = new Coordinate(5, 4);

            Assert.AreEqual(Response.CLASH, control.LandingRequest(rocket02));
        }
コード例 #5
0
        public void BiggerPlatform()
        {
            LandingControl control = new LandingControl(25);

            Coordinate rocket01 = new Coordinate(16, 5);

            Assert.AreEqual(Response.OK_FOR_LANDING, control.LandingRequest(rocket01));

            Coordinate rocket02 = new Coordinate(30, 5);

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(rocket02));
        }
コード例 #6
0
        public void RequestOutsideArea()
        {
            LandingControl control = new LandingControl();

            // not defined, this could makes sense, also throw a controlled exception
            Coordinate rocket05 = new Coordinate(0, 0);

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(rocket05));

            Coordinate rocket06 = new Coordinate(200, 2000);

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(rocket06));
        }
コード例 #7
0
        public void RequestTopCornerPlatform()
        {
            LandingControl control = new LandingControl();

            Coordinate rocket01 = new Coordinate(5, 5);

            Assert.AreEqual(Response.OK_FOR_LANDING, control.LandingRequest(rocket01));
        }
コード例 #8
0
        public void RequestPreviouslyCheckedCornerCases()
        {
            LandingControl control = new LandingControl();

            Coordinate rocket01 = new Coordinate(1, 1);

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(rocket01));

            Coordinate rocket02 = new Coordinate(1, 1);

            Assert.AreEqual(Response.CLASH, control.LandingRequest(rocket02));

            Coordinate rocket03 = new Coordinate(2, 2);

            Assert.AreEqual(Response.CLASH, control.LandingRequest(rocket03));

            Coordinate rocket04 = new Coordinate(100, 100);

            Assert.AreEqual(Response.OUT_OF_PLATFORM, control.LandingRequest(rocket04));

            Coordinate rocket05 = new Coordinate(100, 100);

            Assert.AreEqual(Response.CLASH, control.LandingRequest(rocket05));

            Coordinate rocket06 = new Coordinate(100, 99);

            Assert.AreEqual(Response.CLASH, control.LandingRequest(rocket06));
        }