Пример #1
0
    public async Task OrganizeTreeOrderForMenuItem_ShouldWorkProperly_WithNewMenuItem()
    {
        var menu3Id = Guid.NewGuid();

        var menuItems = await menuItemRepository.GetListAsync();

        var menuItem1 = menuItems.First(x => x.Id == testData.MenuItem_1_Id);
        var menuItem2 = menuItems.First(x => x.Id == testData.MenuItem_2_Id);
        var menuItem3 = new MenuItem(menu3Id, "Menu 3", "#");

        menuItems.Add(menuItem3);

        menuItem3.Order = 0;

        menuManager.OrganizeTreeOrderForMenuItem(menuItems, menuItem3);

        menuItem3.Order.ShouldBeLessThan(menuItem1.Order);
        menuItem3.Order.ShouldBeLessThan(menuItem2.Order);
    }