Esempio n. 1
0
 public void EnterTargetSweet(SweetsController sweet)
 {
     if (!gameOver)
     {
         targetSweet = sweet;
     }
 }
Esempio n. 2
0
        public void Can_Filter_Sweets()
        {
            //Організація (arrange)
            Mock <ISweetRepository> mock = new Mock <ISweetRepository>();

            mock.Setup(m => m.Sweets).Returns(new List <Sweet>
            {
                new Sweet {
                    SweetId = 1, Name = "Sweet1", Type = "Type1"
                },
                new Sweet {
                    SweetId = 2, Name = "Sweet2", Type = "Type2"
                },
                new Sweet {
                    SweetId = 3, Name = "Sweet3", Type = "Type1"
                },
                new Sweet {
                    SweetId = 4, Name = "Sweet4", Type = "Type3"
                },
                new Sweet {
                    SweetId = 5, Name = "Sweet5", Type = "Type2"
                }
            });

            SweetsController controller = new SweetsController(mock.Object);

            controller.pageSize = 3;

            //Дія (act)
            List <Sweet> result = ((SweetsListViewModel)controller.List("Type2", 1).Model).Sweets.ToList();

            Assert.AreEqual(result.Count(), 2);
            Assert.IsTrue(result[0].Name == "Sweet2" && result[0].Type == "Type2");
            Assert.IsTrue(result[1].Name == "Sweet5" && result[1].Type == "Type2");
        }
Esempio n. 3
0
 /// <summary>
 /// Player Event.
 /// </summary>
 #region
 public void PressCurrentSweet(SweetsController sweet)
 {
     if (!gameOver)
     {
         currentSweet = sweet;
     }
 }
Esempio n. 4
0
        public void Can_Retrieve_Image_Data()
        {
            Sweet sweet = new Sweet
            {
                SweetId       = 2,
                Name          = "Sweet2",
                ImageData     = new byte[] { },
                ImageMimeType = "image/png"
            };

            Mock <ISweetRepository> mock = new Mock <ISweetRepository>();

            mock.Setup(m => m.Sweets).Returns(new List <Sweet>
            {
                new Sweet {
                    SweetId = 1, Name = "Sweet1"
                },
                sweet,
                new Sweet {
                    SweetId = 3, Name = "Sweet3"
                }
            }.AsQueryable());

            SweetsController controller = new SweetsController(mock.Object);

            ActionResult result = controller.GetImage(2);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(FileResult));
            Assert.AreEqual(sweet.ImageMimeType, ((FileResult)result).ContentType);
        }
Esempio n. 5
0
    //Eliminate sweets in all range.
    private bool EliminateAllMatchedSweets()
    {
        bool needFill = false;

        for (int y = 0; y < rows; y++)
        {
            for (int x = 0; x < columns; x++)
            {
                if (sweets[x, y].Eliminable())
                {
                    List <SweetsController> matchList = MatchSweets(sweets[x, y], x, y);

                    if (matchList != null)
                    {
                        SweetsType       superSweets    = SweetsType.COUNT;
                        SweetsController superSweetsPos = matchList[Random.Range(0, matchList.Count)];

                        if (matchList.Count == 4)
                        {
                            superSweets = (SweetsType)Random.Range(3, 5);
                        }

                        //matchList.Count >= 5 ... Rainbow Sweets
                        if (matchList.Count >= 5)
                        {
                            superSweets = SweetsType.RAINBOW_CANDY;
                        }

                        for (int i = 0; i < matchList.Count; i++)
                        {
                            if (EliminateSweet(matchList[i].X, matchList[i].Y))
                            {
                                needFill = true;
                            }
                        }

                        //Generate super sweets.
                        if (superSweets != SweetsType.COUNT)
                        {
                            Destroy(sweets[superSweetsPos.X, superSweetsPos.Y]);
                            SweetsController newSweets = CreateNewSweet(superSweetsPos.X, superSweetsPos.Y, superSweets);

                            if (matchList.Count == 4 && newSweets.ColorAble() && matchList[0].ColorAble())
                            {
                                newSweets.ColoredComponent.SetThisType(matchList[0].ColoredComponent.ThisType);
                            }
                            else if (superSweets == SweetsType.RAINBOW_CANDY && newSweets.ColorAble())
                            {
                                //Generate Rainbow Sweets
                                newSweets.ColoredComponent.SetThisType(SweetsColorType.ColorType.UNIVERSAL);
                            }
                        }
                    }
                }
            }
        }
        return(needFill);
    }
Esempio n. 6
0
    //Exchange the positions of two sweets.
    private void ExchangeSweets(SweetsController sweet1, SweetsController sweet2)
    {
        if (sweet1.Movable() && sweet2.Movable())
        {
            sweets[sweet1.X, sweet1.Y] = sweet2;
            sweets[sweet2.X, sweet2.Y] = sweet1;

            if (MatchSweets(sweet1, sweet2.X, sweet2.Y) != null || MatchSweets(sweet2, sweet1.X, sweet1.Y) != null ||
                sweet1.Type == SweetsType.RAINBOW_CANDY || sweet2.Type == SweetsType.RAINBOW_CANDY)
            {
                int tempX = sweet1.X, tempY = sweet1.Y;
                sweet1.MovedComponent.Move(sweet2.X, sweet2.Y, fillTime);
                sweet2.MovedComponent.Move(tempX, tempY, fillTime);

                if (sweet1.Type == SweetsType.RAINBOW_CANDY && sweet1.ColorAble() && sweet2.ColorAble())
                {
                    EliminateAnySweets clearColor = sweet1.GetComponent <EliminateAnySweets>();

                    if (clearColor != null)
                    {
                        clearColor.ClearColor = sweet2.ColoredComponent.ThisType;
                    }
                    EliminateSweet(sweet1.X, sweet1.Y);
                }

                if (sweet2.Type == SweetsType.RAINBOW_CANDY && sweet1.ColorAble() && sweet2.ColorAble())
                {
                    EliminateAnySweets clearColor = sweet2.GetComponent <EliminateAnySweets>();

                    if (clearColor != null)
                    {
                        clearColor.ClearColor = sweet1.ColoredComponent.ThisType;
                    }
                    EliminateSweet(sweet2.X, sweet2.Y);
                }

                EliminateAllMatchedSweets();
                StartCoroutine(FillAll());
            }
            else
            {
                sweets[sweet1.X, sweet1.Y] = sweet1;
                sweets[sweet2.X, sweet2.Y] = sweet2;
            }
        }
    }
Esempio n. 7
0
        public void Cannot_Retrieve_Image_Data_For_Invalid_ID()
        {
            Mock <ISweetRepository> mock = new Mock <ISweetRepository>();

            mock.Setup(m => m.Sweets).Returns(new List <Sweet> {
                new Sweet {
                    SweetId = 1, Name = "Sweet1"
                },
                new Sweet {
                    SweetId = 2, Name = "Sweet2"
                }
            }.AsQueryable());

            SweetsController controller = new SweetsController(mock.Object);

            ActionResult result = controller.GetImage(10);

            Assert.IsNull(result);
        }
Esempio n. 8
0
        public void Generate_Type_Specific_Sweet_Count()
        {
            //Організація (arrange)
            Mock <ISweetRepository> mock = new Mock <ISweetRepository>();

            mock.Setup(m => m.Sweets).Returns(new List <Sweet>
            {
                new Sweet {
                    SweetId = 1, Name = "Sweet1", Type = "Type1"
                },
                new Sweet {
                    SweetId = 2, Name = "Sweet2", Type = "Type2"
                },
                new Sweet {
                    SweetId = 3, Name = "Sweet3", Type = "Type1"
                },
                new Sweet {
                    SweetId = 4, Name = "Sweet4", Type = "Type3"
                },
                new Sweet {
                    SweetId = 5, Name = "Sweet5", Type = "Type2"
                }
            });

            SweetsController controller = new SweetsController(mock.Object);

            controller.pageSize = 3;

            int res1   = ((SweetsListViewModel)controller.List("Type1").Model).PagingInfo.TotalItems;
            int res2   = ((SweetsListViewModel)controller.List("Type2").Model).PagingInfo.TotalItems;
            int res3   = ((SweetsListViewModel)controller.List("Type3").Model).PagingInfo.TotalItems;
            int resAll = ((SweetsListViewModel)controller.List(null).Model).PagingInfo.TotalItems;

            Assert.AreEqual(res1, 2);
            Assert.AreEqual(res1, 2);
            Assert.AreEqual(res3, 1);
            Assert.AreEqual(resAll, 5);
        }
Esempio n. 9
0
    public List <SweetsController> MatchSweets(SweetsController sweet, int newX, int newY)
    {
        if (sweet.ColorAble())
        {
            SweetsColorType.ColorType color = sweet.ColoredComponent.ThisType;
            List <SweetsController>   matchSweetsInSameRow = new List <SweetsController>();
            List <SweetsController>   matchSweetsInSameCol = new List <SweetsController>();
            List <SweetsController>   matchingResult       = new List <SweetsController>();

            //row maching
            matchSweetsInSameRow.Add(sweet);
            //match the current row.(0->left, 1->right)
            for (int i = 0; i <= 1; i++)
            {
                for (int xDis = 1; xDis < columns; xDis++)
                {
                    int x = newX;
                    if (i == 0)  //traverse the left side.
                    {
                        x -= xDis;
                    }
                    if (i == 1)  //traverse the right side.
                    {
                        x += xDis;
                    }
                    if (x < 0 || x >= columns)  //encounter the border.
                    {
                        break;
                    }

                    if (sweets[x, newY].ColorAble() && sweets[x, newY].ColoredComponent.ThisType == color)
                    {
                        matchSweetsInSameRow.Add(sweets[x, newY]);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            //"L","T" shape matching.
            if (matchSweetsInSameRow.Count >= 3)
            {
                for (int i = 0; i < matchSweetsInSameRow.Count; i++)
                {
                    matchingResult.Add(matchSweetsInSameRow[i]);
                }
                for (int j = 0; j <= 1; j++)  //只需扫描被调换元素的列而无需所有行匹配成功元素?
                {
                    //apply col-matching to the first element.
                    for (int yDis = 1; yDis <= rows; yDis++)
                    {
                        int y = newY;
                        if (j == 0)
                        {
                            y -= yDis;
                        }
                        if (j == 1)
                        {
                            y += yDis;
                        }
                        if (y < 0 || y >= rows)
                        {
                            break;
                        }

                        if (sweets[matchSweetsInSameRow[0].X, y].ColorAble() && sweets[matchSweetsInSameRow[0].X, y].ColoredComponent.ThisType == color)
                        {
                            matchSweetsInSameCol.Add(sweets[matchSweetsInSameRow[0].X, y]);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                if (matchSweetsInSameCol.Count < 2)
                {
                    matchSweetsInSameCol.Clear();
                }
                else
                {
                    for (int k = 0; k < matchSweetsInSameCol.Count; k++)
                    {
                        matchingResult.Add(matchSweetsInSameCol[k]);
                    }
                }
            }

            if (matchingResult.Count >= 3)
            {
                //If successed in matching sweets in one row, then return.
                return(matchingResult);
            }
            else
            {
                matchSweetsInSameRow.Clear();
                matchSweetsInSameCol.Clear();
            }

            //columns matching
            matchSweetsInSameCol.Add(sweet);  //basic element
            //match the current row to the left and to the right.
            for (int i = 0; i <= 1; i++)
            {
                for (int yDis = 1; yDis < rows; yDis++)
                {
                    int y = newY;
                    if (i == 0)  //traverse the up side.
                    {
                        y -= yDis;
                    }
                    if (i == 1)  //traverse the down side.
                    {
                        y += yDis;
                    }
                    if (y < 0 || y >= rows)  //encounter the border.
                    {
                        break;
                    }

                    if (sweets[newX, y].ColorAble() && sweets[newX, y].ColoredComponent.ThisType == color)
                    {
                        matchSweetsInSameCol.Add(sweets[newX, y]);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (matchSweetsInSameCol.Count >= 3)
            {
                for (int i = 0; i < matchSweetsInSameCol.Count; i++)
                {
                    matchingResult.Add(matchSweetsInSameCol[i]);
                }
                for (int j = 0; j <= 1; j++)
                {
                    for (int xDis = 1; xDis < columns; xDis++)
                    {
                        int x = newX;
                        if (j == 0)
                        {
                            x -= xDis;
                        }
                        if (j == 1)
                        {
                            x += xDis;
                        }
                        if (x < 0 || x >= columns)
                        {
                            break;
                        }

                        if (sweets[x, matchSweetsInSameCol[0].Y].ColorAble() && sweets[x, matchSweetsInSameCol[0].Y].ColoredComponent.ThisType == color)
                        {
                            matchSweetsInSameRow.Add(sweets[x, matchSweetsInSameCol[0].Y]);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                if (matchSweetsInSameRow.Count < 2)
                {
                    matchSweetsInSameRow.Clear();
                }
                else
                {
                    for (int k = 0; k < matchSweetsInSameRow.Count; k++)
                    {
                        matchingResult.Add(matchSweetsInSameRow[k]);
                    }
                }
            }

            if (matchingResult.Count >= 3)
            {
                //If successed in matching sweets in one column.
                return(matchingResult);
            }
        }

        return(null);
    }
Esempio n. 10
0
 //Judge if two sweets are adjacent.
 private bool IsAdjacent(SweetsController sweet1, SweetsController sweet2)
 {
     return((sweet1.X == sweet2.X && Mathf.Abs(sweet1.Y - sweet2.Y) == 1) ||
            (sweet1.Y == sweet2.Y && Mathf.Abs(sweet1.X - sweet2.X) == 1));
 }
Esempio n. 11
0
    //Fill the grids one by one.
    public bool Fill()
    {
        bool filledNotFinished = false;

        //From bottom to top.
        for (int y = rows - 2; y >= 0; y--)
        {
            for (int x = 0; x < columns; x++)
            {
                SweetsController sweet = sweets[x, y];

                if (sweet.Movable())                                //无法移动则无法向下填充(垂直填充).
                {
                    SweetsController sweetBelow = sweets[x, y + 1]; //得到当前位置下方的实体.

                    if (sweetBelow.Type == SweetsType.EMPTY)        //下方当前为空物体,允许垂直填充.
                    {
                        Destroy(sweetBelow.gameObject);
                        sweet.MovedComponent.Move(x, y + 1, fillTime);
                        sweets[x, y + 1] = sweet;
                        CreateNewSweet(x, y, SweetsType.EMPTY);
                        filledNotFinished = true;
                    }
                    else //向左右偏移填充
                    {
                        for (int d = -1; d <= 1; d++)
                        {
                            if (d != 0)  //排除正下方.
                            {
                                int down = x + d;

                                if (down >= 0 && down < columns)
                                {
                                    SweetsController downSweet = sweets[down, y + 1];
                                    if (downSweet.Type == SweetsType.EMPTY)
                                    {
                                        bool vertical_fillable = true;  //用于判断垂直填充是否能满足向下填充.
                                        for (int above = y; above >= 0; above--)
                                        {
                                            SweetsController aboveSweet = sweets[down, above];
                                            if (aboveSweet.Movable())
                                            {
                                                //左下方空白的正上方有可向下填充的物体,则不用向侧下填充.
                                                break;
                                            }
                                            else if (!aboveSweet.Movable() && aboveSweet.Type != SweetsType.EMPTY)
                                            {
                                                vertical_fillable = false;
                                                break;
                                            }
                                        }

                                        if (!vertical_fillable)
                                        {
                                            Destroy(downSweet.gameObject);
                                            sweet.MovedComponent.Move(down, y + 1, fillTime);
                                            sweets[down, y + 1] = sweet;
                                            CreateNewSweet(x, y, SweetsType.EMPTY);
                                            filledNotFinished = true;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        //Exceptional case: the top row
        for (int x = 0; x < columns; x++)
        {
            SweetsController sweet = sweets[x, 0];
            if (sweet.Type == SweetsType.EMPTY)
            {
                GameObject newSweet =
                    Instantiate(sweetsPrefabDic[SweetsType.NORMAL], CalibratePosition(x, -1), Quaternion.identity);
                newSweet.transform.parent = transform;

                sweets[x, 0] = newSweet.GetComponent <SweetsController>();
                sweets[x, 0].Init(x, -1, this, SweetsType.NORMAL);
                sweets[x, 0].MovedComponent.Move(x, 0, fillTime);
                sweets[x, 0].ColoredComponent.SetThisType(  //随机生成一种类型的甜品 **枚举为特殊的int**
                    (SweetsColorType.ColorType)Random.Range(0, sweets[x, 0].ColoredComponent.MaxColorsNum));
                filledNotFinished = true;
            }
        }
        //Filling finished or not.
        return(filledNotFinished);
    }
Esempio n. 12
0
 private void Awake()
 {
     sweet = GetComponent <SweetsController>();
 }
Esempio n. 13
0
        public void Can_Send_Pagination_View_Model()
        {
            //Організація (arrange)
            Mock <ISweetRepository> mock = new Mock <ISweetRepository>();

            mock.Setup(m => m.Sweets).Returns(new List <Sweet>
            {
                new Sweet {
                    SweetId = 1, Name = "Sweet1"
                },
                new Sweet {
                    SweetId = 2, Name = "Sweet2"
                },
                new Sweet {
                    SweetId = 3, Name = "Sweet3"
                },
                new Sweet {
                    SweetId = 4, Name = "Sweet4"
                },
                new Sweet {
                    SweetId = 5, Name = "Sweet5"
                },
                new Sweet {
                    SweetId = 6, Name = "Sweet6"
                },
                new Sweet {
                    SweetId = 7, Name = "Sweet7"
                },
                new Sweet {
                    SweetId = 8, Name = "Sweet8"
                },
                new Sweet {
                    SweetId = 9, Name = "Sweet9"
                },
                new Sweet {
                    SweetId = 10, Name = "Sweet10"
                },
                new Sweet {
                    SweetId = 11, Name = "Sweet11"
                },
                new Sweet {
                    SweetId = 12, Name = "Sweet12"
                },
                new Sweet {
                    SweetId = 13, Name = "Sweet13"
                },
                new Sweet {
                    SweetId = 14, Name = "Sweet14"
                },
                new Sweet {
                    SweetId = 15, Name = "Sweet15"
                },
                new Sweet {
                    SweetId = 16, Name = "Sweet16"
                },
                new Sweet {
                    SweetId = 17, Name = "Sweet17"
                },
                new Sweet {
                    SweetId = 18, Name = "Sweet18"
                },
                new Sweet {
                    SweetId = 19, Name = "Sweet19"
                },
                new Sweet {
                    SweetId = 20, Name = "Sweet20"
                },
                new Sweet {
                    SweetId = 21, Name = "Sweet21"
                },
                new Sweet {
                    SweetId = 22, Name = "Sweet22"
                },
                new Sweet {
                    SweetId = 23, Name = "Sweet23"
                },
                new Sweet {
                    SweetId = 24, Name = "Sweet24"
                },
                new Sweet {
                    SweetId = 25, Name = "Sweet25"
                },
                new Sweet {
                    SweetId = 26, Name = "Sweet26"
                },
                new Sweet {
                    SweetId = 27, Name = "Sweet27"
                },
                new Sweet {
                    SweetId = 28, Name = "Sweet28"
                },
                new Sweet {
                    SweetId = 29, Name = "Sweet29"
                },
                new Sweet {
                    SweetId = 30, Name = "Sweet30"
                },
                new Sweet {
                    SweetId = 31, Name = "Sweet31"
                },
                new Sweet {
                    SweetId = 32, Name = "Sweet32"
                },
                new Sweet {
                    SweetId = 33, Name = "Sweet33"
                },
                new Sweet {
                    SweetId = 34, Name = "Sweet34"
                },
                new Sweet {
                    SweetId = 35, Name = "Sweet35"
                },
                new Sweet {
                    SweetId = 36, Name = "Sweet36"
                },
                new Sweet {
                    SweetId = 37, Name = "Sweet37"
                },
                new Sweet {
                    SweetId = 38, Name = "Sweet38"
                },
                new Sweet {
                    SweetId = 39, Name = "Sweet39"
                },
                new Sweet {
                    SweetId = 40, Name = "Sweet40"
                },
                new Sweet {
                    SweetId = 41, Name = "Sweet41"
                },
                new Sweet {
                    SweetId = 42, Name = "Sweet42"
                },
                new Sweet {
                    SweetId = 43, Name = "Sweet43"
                },
                new Sweet {
                    SweetId = 44, Name = "Sweet44"
                },
                new Sweet {
                    SweetId = 45, Name = "Sweet45"
                },
                new Sweet {
                    SweetId = 46, Name = "Sweet46"
                },
                new Sweet {
                    SweetId = 47, Name = "Sweet47"
                },
                new Sweet {
                    SweetId = 48, Name = "Sweet48"
                },
                new Sweet {
                    SweetId = 49, Name = "Sweet49"
                },
                new Sweet {
                    SweetId = 50, Name = "Sweet50"
                },
                new Sweet {
                    SweetId = 51, Name = "Sweet51"
                },
                new Sweet {
                    SweetId = 52, Name = "Sweet52"
                },
                new Sweet {
                    SweetId = 53, Name = "Sweet53"
                },
                new Sweet {
                    SweetId = 54, Name = "Sweet54"
                },
                new Sweet {
                    SweetId = 55, Name = "Sweet55"
                },
                new Sweet {
                    SweetId = 56, Name = "Sweet56"
                },
                new Sweet {
                    SweetId = 57, Name = "Sweet57"
                },
                new Sweet {
                    SweetId = 58, Name = "Sweet58"
                },
                new Sweet {
                    SweetId = 59, Name = "Sweet59"
                },
                new Sweet {
                    SweetId = 60, Name = "Sweet60"
                },
                new Sweet {
                    SweetId = 61, Name = "Sweet61"
                },
                new Sweet {
                    SweetId = 62, Name = "Sweet62"
                },
                new Sweet {
                    SweetId = 63, Name = "Sweet63"
                },
                new Sweet {
                    SweetId = 64, Name = "Sweet64"
                },
                new Sweet {
                    SweetId = 65, Name = "Sweet65"
                }
            });

            SweetsController controller = new SweetsController(mock.Object);

            controller.pageSize = 4;

            //Дія (act)
            SweetsListViewModel result = (SweetsListViewModel)controller.List(null, 16).Model;

            PagingInfo pagingInfo = result.PagingInfo;

            Assert.AreEqual(pagingInfo.CurrentPage, 16);
            Assert.AreEqual(pagingInfo.ItemsPerPage, 4);
            Assert.AreEqual(pagingInfo.TotalItems, 65);
            Assert.AreEqual(pagingInfo.TotalPages, 17);
        }
Esempio n. 14
0
        public void Can_Paginate()
        {
            //Організація (arrange)
            Mock <ISweetRepository> mock = new Mock <ISweetRepository>();

            mock.Setup(m => m.Sweets).Returns(new List <Sweet>
            {
                new Sweet {
                    SweetId = 1, Name = "Sweet1"
                },
                new Sweet {
                    SweetId = 2, Name = "Sweet2"
                },
                new Sweet {
                    SweetId = 3, Name = "Sweet3"
                },
                new Sweet {
                    SweetId = 4, Name = "Sweet4"
                },
                new Sweet {
                    SweetId = 5, Name = "Sweet5"
                },
                new Sweet {
                    SweetId = 6, Name = "Sweet6"
                },
                new Sweet {
                    SweetId = 7, Name = "Sweet7"
                },
                new Sweet {
                    SweetId = 8, Name = "Sweet8"
                },
                new Sweet {
                    SweetId = 9, Name = "Sweet9"
                },
                new Sweet {
                    SweetId = 10, Name = "Sweet10"
                },
                new Sweet {
                    SweetId = 11, Name = "Sweet11"
                },
                new Sweet {
                    SweetId = 12, Name = "Sweet12"
                },
                new Sweet {
                    SweetId = 13, Name = "Sweet13"
                },
                new Sweet {
                    SweetId = 14, Name = "Sweet14"
                },
                new Sweet {
                    SweetId = 15, Name = "Sweet15"
                },
                new Sweet {
                    SweetId = 16, Name = "Sweet16"
                },
                new Sweet {
                    SweetId = 17, Name = "Sweet17"
                },
                new Sweet {
                    SweetId = 18, Name = "Sweet18"
                },
                new Sweet {
                    SweetId = 19, Name = "Sweet19"
                },
                new Sweet {
                    SweetId = 20, Name = "Sweet20"
                },
                new Sweet {
                    SweetId = 21, Name = "Sweet21"
                },
                new Sweet {
                    SweetId = 22, Name = "Sweet22"
                },
                new Sweet {
                    SweetId = 23, Name = "Sweet23"
                },
                new Sweet {
                    SweetId = 24, Name = "Sweet24"
                },
                new Sweet {
                    SweetId = 25, Name = "Sweet25"
                },
                new Sweet {
                    SweetId = 26, Name = "Sweet26"
                },
                new Sweet {
                    SweetId = 27, Name = "Sweet27"
                },
                new Sweet {
                    SweetId = 28, Name = "Sweet28"
                },
                new Sweet {
                    SweetId = 29, Name = "Sweet29"
                },
                new Sweet {
                    SweetId = 30, Name = "Sweet30"
                },
                new Sweet {
                    SweetId = 31, Name = "Sweet31"
                },
                new Sweet {
                    SweetId = 32, Name = "Sweet32"
                },
                new Sweet {
                    SweetId = 33, Name = "Sweet33"
                },
                new Sweet {
                    SweetId = 34, Name = "Sweet34"
                },
                new Sweet {
                    SweetId = 35, Name = "Sweet35"
                },
                new Sweet {
                    SweetId = 36, Name = "Sweet36"
                },
                new Sweet {
                    SweetId = 37, Name = "Sweet37"
                },
                new Sweet {
                    SweetId = 38, Name = "Sweet38"
                },
                new Sweet {
                    SweetId = 39, Name = "Sweet39"
                },
                new Sweet {
                    SweetId = 40, Name = "Sweet40"
                },
                new Sweet {
                    SweetId = 41, Name = "Sweet41"
                },
                new Sweet {
                    SweetId = 42, Name = "Sweet42"
                },
                new Sweet {
                    SweetId = 43, Name = "Sweet43"
                },
                new Sweet {
                    SweetId = 44, Name = "Sweet44"
                },
                new Sweet {
                    SweetId = 45, Name = "Sweet45"
                },
                new Sweet {
                    SweetId = 46, Name = "Sweet46"
                },
                new Sweet {
                    SweetId = 47, Name = "Sweet47"
                },
                new Sweet {
                    SweetId = 48, Name = "Sweet48"
                },
                new Sweet {
                    SweetId = 49, Name = "Sweet49"
                },
                new Sweet {
                    SweetId = 50, Name = "Sweet50"
                },
                new Sweet {
                    SweetId = 51, Name = "Sweet51"
                },
                new Sweet {
                    SweetId = 52, Name = "Sweet52"
                },
                new Sweet {
                    SweetId = 53, Name = "Sweet53"
                },
                new Sweet {
                    SweetId = 54, Name = "Sweet54"
                },
                new Sweet {
                    SweetId = 55, Name = "Sweet55"
                },
                new Sweet {
                    SweetId = 56, Name = "Sweet56"
                },
                new Sweet {
                    SweetId = 57, Name = "Sweet57"
                },
                new Sweet {
                    SweetId = 58, Name = "Sweet58"
                },
                new Sweet {
                    SweetId = 59, Name = "Sweet59"
                },
                new Sweet {
                    SweetId = 60, Name = "Sweet60"
                },
                new Sweet {
                    SweetId = 61, Name = "Sweet61"
                },
                new Sweet {
                    SweetId = 62, Name = "Sweet62"
                },
                new Sweet {
                    SweetId = 63, Name = "Sweet63"
                },
                new Sweet {
                    SweetId = 64, Name = "Sweet64"
                },
                new Sweet {
                    SweetId = 65, Name = "Sweet65"
                }
            });

            SweetsController controller = new SweetsController(mock.Object);

            controller.pageSize = 4;

            //Дія (act)
            SweetsListViewModel result = (SweetsListViewModel)controller.List(null, 17).Model;

            //Ствердження (assert)
            List <Sweet> sweets = result.Sweets.ToList();

            Assert.IsTrue(sweets.Count == 1);
            Assert.AreEqual(sweets[0].Name, "Sweet65");
        }