コード例 #1
0
        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 widgetService = new DefaultWidgetService(repository, uow, optionService, contentService, childContentService, categoryService.Object);

                DeleteWidgetCommand command = new DeleteWidgetCommand(widgetService);

                bool success = command.Execute(new DeleteWidgetRequest
                                                    {
                                                        WidgetId = htmlContentWidget.Id,
                                                        Version = htmlContentWidget.Version
                                                    });
                Assert.IsTrue(success);
            });
        }
コード例 #2
0
        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 widgetService = new DefaultWidgetService(repository, uow, optionService, contentService);

                DeleteWidgetCommand command = new DeleteWidgetCommand(widgetService);

                bool success = command.Execute(new DeleteWidgetRequest
                {
                    WidgetId = htmlContentWidget.Id,
                    Version  = htmlContentWidget.Version
                });
                Assert.IsTrue(success);
            });
        }
コード例 #3
0
        public void Should_Delete_HtmlContentWidget_Successfully()
        {
            var htmlContentWidget = TestDataProvider.CreateNewHtmlContentWidget();

            RunActionInTransaction(session =>
            {
                session.SaveOrUpdate(htmlContentWidget);
                session.Flush();
                session.Clear();

                DeleteWidgetCommand command = new DeleteWidgetCommand();
                command.UnitOfWork          = new DefaultUnitOfWork(session);
                command.Repository          = new DefaultRepository(command.UnitOfWork);

                bool success = command.Execute(new DeleteWidgetRequest
                {
                    WidgetId = htmlContentWidget.Id,
                    Version  = htmlContentWidget.Version
                });
                Assert.IsTrue(success);
            });
        }
コード例 #4
0
        public void Should_Delete_ServerControlWidget_Successfully()
        {
            var serverControlWidget = TestDataProvider.CreateNewServerControlWidget();

            RunActionInTransaction(session =>
                {
                    session.SaveOrUpdate(serverControlWidget);
                    session.Flush();
                    session.Clear();

                    DeleteWidgetCommand command = new DeleteWidgetCommand();
                    command.UnitOfWork = new DefaultUnitOfWork(session);
                    command.Repository = new DefaultRepository(command.UnitOfWork);

                    bool success = command.Execute(new DeleteWidgetRequest
                                                       {
                                                           WidgetId = serverControlWidget.Id,
                                                           Version = serverControlWidget.Version
                                                       });
                    Assert.IsTrue(success);
                });
        }