Пример #1
0
        public async void User_can_drag_a_widget_from_an_area_to_another_area()
        {
            // Given a widget in area blog sidebar1
            var widgetId = await _svc.CreateWidgetAsync(MY_WIDGET_TYPE);

            await _svc.AddWidgetToAreaAsync(widgetId, WidgetService.BlogSidebar1.Id, 0);

            // When user drags the widget from area sidebar1 to area sidebar2
            await _svc.RemoveWidgetFromAreaAsync(widgetId, WidgetService.BlogSidebar1.Id);

            await _svc.AddWidgetToAreaAsync(widgetId, WidgetService.BlogSidebar2.Id, 0);

            // Then area sidebar1 would not have the widget anymore
            var area1 = await _svc.GetAreaAsync(WidgetService.BlogSidebar1.Id);

            Assert.DoesNotContain(widgetId, area1.WidgetIds);

            // and area sidebar2 would have the widget
            var area2 = await _svc.GetAreaAsync(WidgetService.BlogSidebar2.Id);

            Assert.Contains(widgetId, area2.WidgetIds);

            // and widget's areaId will be updated too
            var widgetAgain = await _svc.GetWidgetAsync(widgetId);

            Assert.Equal(WidgetService.BlogSidebar2.Id, widgetAgain.AreaId);
        }