コード例 #1
0
        public void Create_landing_area_success()
        {
            ISize     landingAreaSize     = Size.Create(100, 100);
            ISize     platformSize        = Size.Create(10, 10);
            IPosition platformoutPosition = Position.Create(5, 5);

            Assert.NotNull(Landings.Create(landingAreaSize, platformSize, platformoutPosition));
        }
コード例 #2
0
        public void Create_landing_area_error()
        {
            ISize     landingAreaSize     = Size.Create(100, 100);
            ISize     platformSize        = Size.Create(10, 10);
            IPosition platformOutPosition = Position.Create(101, 5);
            IPosition platformPosition    = Position.Create(95, 95);

            Assert.Throws <OutOfLandingAreaDomainException>(() => Landings.Create(landingAreaSize, platformSize, platformOutPosition));
            Assert.Throws <OutOfLandingAreaDomainException>(() => Landings.Create(landingAreaSize, platformSize, platformPosition));
        }
コード例 #3
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);
        }
コード例 #4
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);
        }