public void Should_Delete_HtmlContentWidget_Successfully()
{
var htmlContentWidget = TestDataProvider.CreateNewHtmlContentWidget();
RunActionInTransaction(session =>
{
session.SaveOrUpdate(htmlContentWidget);
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 = htmlContentWidget.Id,
Version = htmlContentWidget.Version
});
Assert.IsTrue(success);
});
}
}