public void ShouldThrowExceptionWhenRoomIsTooSmall()
        {
            IDesignAlgorithm algorithm = new TestSetupDesign();
            ProductModel     chair     = new ProductModel {
                Brand  = "Ahrend",
                Width  = 1,
                Height = 1
            };
            ProductModel table = new ProductModel {
                Brand  = "TableCompany",
                Width  = 2,
                Height = 1
            };

            int   width  = 10;
            int   height = 10;
            int   people = 10;
            float margin = 0.5f;

            try {
                List <ProductModel> result = algorithm.Design(chair, table, people, width, height, margin);
            }
            catch (RoomTooSmallException e) {
                throw;
            }
        }
        public void PairShouldBeCorrectSize()
        {
            TestSetupDesign algo  = new TestSetupDesign();
            ProductModel    chair = new ProductModel {
                Brand  = "Ahrend",
                Width  = 1,
                Height = 1
            };
            ProductModel table = new ProductModel {
                Brand  = "TableCompany",
                Width  = 2,
                Height = 1
            };
            float margin         = 0.5f;
            int   expectedWidth  = (int)(chair.Height + table.Height + margin * 2);
            int   expectedHeight = (int)(table.Width + margin * 2);

            int                   width            = 10;
            int                   height           = 10;
            ChairTablePair        pair             = ChairTablePair.CreatePair(chair, table, 0.5f);
            List <Rectangle>      possibilities    = algo.CalculatePossibilities(pair, width, height, 0.5f);
            List <ChairTablePair> designResult     = algo.FillRoom(7, pair, possibilities);
            ChairTablePair        teacher          = designResult[0];
            Rectangle             teacherRectangle = teacher.Representation;
            int                   actualWidth      = teacherRectangle.Width;
            int                   actualHeight     = teacherRectangle.Height;

            Assert.IsTrue(actualHeight == expectedHeight && actualWidth == expectedWidth);
        }
        public void ShouldReturnAllPairsWithCorrectColAndRows_Teacher_X0_YHalfHeight()
        {
            TestSetupDesign algo  = new TestSetupDesign();
            ProductModel    chair = new ProductModel {
                Brand  = "Ahrend",
                Width  = 1,
                Height = 1
            };
            ProductModel table = new ProductModel {
                Brand  = "TableCompany",
                Width  = 2,
                Height = 1
            };

            int                   width          = 10;
            int                   height         = 10;
            int                   people         = 7;
            float                 margin         = 0.5f;
            ChairTablePair        pair           = ChairTablePair.CreatePair(chair, table, margin);
            List <Rectangle>      possibilities  = algo.CalculatePossibilities(pair, width, height, margin);
            List <ChairTablePair> result         = algo.FillRoom(7, pair, possibilities);
            Rectangle             teacher        = result[0].Representation;
            int                   rectanglewidth = (int)(chair.Height + table.Height + margin * 2); // 3
            int                   columns        = width / rectanglewidth;                          // 3 (col 0, col 1, col 2)
            int                   teachercol     = 0;                                               // Should be the first column since we want a left orientation
            int                   teacherrow     = 3;                                               // teacher should be in the middle of the column

            Assert.IsTrue(teacher.X == teachercol && teacher.Y == teacherrow);
        }
        public void ShouldCalculateAllPossibilitiesInRoom_WithHorizontalOrientation()
        {
            TestSetupDesign algo  = new TestSetupDesign();
            ProductModel    chair = new ProductModel {
                Brand  = "Ahrend",
                Width  = 1,
                Height = 1
            };
            ProductModel table = new ProductModel {
                Brand  = "TableCompany",
                Width  = 2,
                Height = 1
            };
            ChairTablePair   pair   = ChairTablePair.CreatePair(chair, table, 0.5f);
            List <Rectangle> result = algo.CalculatePossibilities(pair, 10, 10, 0.5f);

            Assert.IsTrue(result.Count > 1);
        }
        public void ShouldReturnListOfProducts()
        {
            IDesignAlgorithm algorithm = new TestSetupDesign();
            ProductModel     chair     = new ProductModel {
                Brand  = "Ahrend",
                Width  = 1,
                Height = 1
            };
            ProductModel table = new ProductModel {
                Brand  = "TableCompany",
                Width  = 2,
                Height = 1
            };

            int   width  = 10;
            int   height = 10;
            int   people = 7;
            float margin = 0.5f;

            List <ProductModel> result = algorithm.Design(chair, table, people, width, height, margin);

            Assert.IsTrue(result.Count > 0);
            Assert.IsTrue(result.Count == (people * 2));
        }