public void Should_Delete_ServerControlWidget_Successfully()
{
var serverControlWidget = TestDataProvider.CreateNewServerControlWidget();
RunActionInTransaction(session =>
{
session.SaveOrUpdate(serverControlWidget);
session.Flush();
session.Clear();
var uow = new DefaultUnitOfWork(session);
var repository = new DefaultRepository(uow);
var optionService = new Mock<IOptionService>().Object;
var contentService = new Mock<IContentService>().Object;
var childContentService = new Mock<IChildContentService>().Object;
var categoryService = new Mock<ICategoryService>();
var cmsConfiguration = new Mock<ICmsConfiguration>().Object;
var widgetService = new DefaultWidgetService(repository, uow, optionService, contentService, childContentService, categoryService.Object, cmsConfiguration);
var command = new DeleteWidgetCommand(widgetService);
bool success = command.Execute(new DeleteWidgetRequest
{
WidgetId = serverControlWidget.Id,
Version = serverControlWidget.Version
});
Assert.IsTrue(success);
});
}