Exemplo n.º 1
0
        public void Rocket_landing_in_custom_platform_class()
        {
            ISize     landingAreaSize  = Size.Create(100, 100);
            ISize     platformSize     = Size.Create(20, 20);
            IPosition platformPosition = Position.Create(40, 5);
            Landings  landings         = Landings.Create(landingAreaSize, platformSize, platformPosition);

            landings.Land(42, 8);

            LandingResponseEnum result = landings.Land(43, 8);

            Assert.Equal(LandingResponseEnum.Clash, result);
        }
Exemplo n.º 2
0
        public void Rocket_landing_clash()
        {
            Landings landings = Landings.Default();

            landings.Land(7, 7);

            LandingResponseEnum clash1 = landings.Land(7, 8);
            LandingResponseEnum clash2 = landings.Land(6, 7);
            LandingResponseEnum clash3 = landings.Land(6, 6);

            Assert.Equal(LandingResponseEnum.Clash, clash1);
            Assert.Equal(LandingResponseEnum.Clash, clash2);
            Assert.Equal(LandingResponseEnum.Clash, clash3);
        }
Exemplo n.º 3
0
        public void Rocket_landing_out_platform()
        {
            Landings landings = Landings.Default();

            LandingResponseEnum result = landings.Land(16, 15);

            Assert.Equal(LandingResponseEnum.OutOfPlatform, result);
        }
Exemplo n.º 4
0
        public void Rocket_landing_success()
        {
            Landings landings = Landings.Default();

            LandingResponseEnum result = landings.Land(5, 5);

            Assert.Equal(LandingResponseEnum.OkForLanding, result);
        }
Exemplo n.º 5
0
        public void Rocket_landing_in_custom_platform_out_platform()
        {
            ISize     landingAreaSize  = Size.Create(100, 100);
            ISize     platformSize     = Size.Create(20, 20);
            IPosition platformPosition = Position.Create(40, 5);
            Landings  landings         = Landings.Create(landingAreaSize, platformSize, platformPosition);

            LandingResponseEnum result = landings.Land(5, 5);

            Assert.Equal(LandingResponseEnum.OutOfPlatform, result);
        }
Exemplo n.º 6
0
        public void Multiple_rocket_landing_clash()
        {
            Landings landings = Landings.Default();

            IPosition rocket1 = Position.Create(7, 7);
            IPosition rocket2 = Position.Create(7, 8);

            List <LandingResponseEnum> results = landings.Land(new List <IPosition> {
                rocket1, rocket2
            });

            Assert.True(results.FindAll(r => r == LandingResponseEnum.Clash).Count > 0);
        }
Exemplo n.º 7
0
        public void Multiple_rocket_landing_success()
        {
            Landings landings = Landings.Default();

            IPosition rocket1 = Position.Create(5, 5);
            IPosition rocket2 = Position.Create(7, 7);

            List <LandingResponseEnum> results = landings.Land(new List <IPosition> {
                rocket1, rocket2
            });

            Assert.True(results.TrueForAll(r => r == LandingResponseEnum.OkForLanding));
        }