Beispiel #1
0
        public void IsAllowed_Map1x2_False()
        {
            var areaSurface = new AreaSurfaceCalculationService();

            var model = new CalculatingSurfaceIncomeModel
            {
                Coordinates = new[] { 0, 0 },
                Map         = new[, ] {
                    { "#", "#" }
                }
            };

            Assert.AreEqual("The Operation can not be completed. The size of the map should be 2x2 and bigger.", areaSurface.CalculateSurfaceAreas(model));
        }
Beispiel #2
0
        public void SurfaceAreaOfWater_Map2x2_3()
        {
            var areaSurface = new AreaSurfaceCalculationService();

            var model = new CalculatingSurfaceIncomeModel
            {
                Coordinates = new[] { 0, 0 },
                Map         = new[, ]
                {
                    { "O", "O" },
                    { "#", "O" }
                }
            };

            Assert.AreEqual("The given map has surface area of 3 square meters.", areaSurface.CalculateSurfaceAreas(model));
        }
Beispiel #3
0
        public void SurfaceAreaOfWater_Empty()
        {
            var areaSurface = new AreaSurfaceCalculationService();

            var model = new CalculatingSurfaceIncomeModel
            {
                Coordinates = new[] { 0, 0 },
                Map         = new[, ]
                {
                    { "#", "#", "#", "#" },
                    { "#", "#", "#", "#" },
                    { "#", "#", "#", "#" },
                    { "#", "#", "#", "#" }
                }
            };

            Assert.AreEqual("The given map does not have surface area of water.", areaSurface.CalculateSurfaceAreas(model));
        }