public PublishingService GetService(SiteContext context)
        {
            var filesPath = HostingEnvironment.MapPath(String.Format("~/App_Data/Pages/{0}/{1}", context.StoreId, context.Language));
            var service   = new PublishingService(filesPath, new[] { new LiquidTemplateEngine(filesPath) });

            return(service);
        }
Example #2
0
        public PublishingServiceTest()
        {
            var userStoreMock = new Mock <IUserStore <DbUser> >();

            mockUserManager =
                new Mock <UserManager <DbUser> >(
                    userStoreMock.Object,
                    null, null, null, null, null, null, null, null
                    );

            mockHttpContextAccessor = new Mock <IHttpContextAccessor>();
            var mockHttpContext = new Mock <HttpContext>();

            mockHttpContextAccessor.Setup(obj => obj.HttpContext).Returns(mockHttpContext.Object);

            var options = new DbContextOptionsBuilder <PortalContext>()
                          .UseInMemoryDatabase("PortalTest")
                          .Options;

            portalContext = new PortalContext(options);
            portalContext.Database.EnsureCreated();

            DbInitializer.ApplyToContext(portalContext);

            mockUserManager
            .Setup(obj => obj.GetUserAsync(It.IsAny <ClaimsPrincipal>()))
            .Returns(Task.FromResult(DbInitializer.Publishers.Instrument));

            service = new PublishingService(portalContext, mockHttpContextAccessor.Object, mockUserManager.Object);
        }
 public ProductAdminController()
 {
     this.publishingService = new PublishingService<auRant.Core.Entities.Product, DraftProduct, ProductRepository>(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productCategoryService = new ProductCategoryService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productStatusService = new ProductStatusService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.supplierService = new SupplierService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.helperService = new HelperService();
 }
Example #4
0
 public ProductAdminController()
 {
     this.publishingService      = new PublishingService <auRant.Core.Entities.Product, DraftProduct, ProductRepository>(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productCategoryService = new ProductCategoryService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productStatusService   = new ProductStatusService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.supplierService        = new SupplierService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.helperService          = new HelperService();
 }
Example #5
0
        public async Task <ActionResult> GetPublishing(string name)
        {
            var publishingExists = await PublishingService.Exists(name);

            if (!publishingExists)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            return(View(await PublishingService.GetByNameAsync(name)));
        }
Example #6
0
        //Do wyświetlenia zmiany w tabeli
        public async Task <ActionResult> GetPublishingData(int id)
        {
            var publishing = await PublishingService.GetById(id);

            var model = new
            {
                NameForDisplay = publishing.NameForDisplay
            };

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public void Campaign_Should_Be_Updated_If_Upload_Succeeds()
        {
            SetupActiveCampaignWithScreens();
            var defaultLastPublishDateTime = Campaigns.FirstOrDefault().Screens.FirstOrDefault().LastPublishDateTime;

            PublishingService.PublishPosterToScreen(new PublishPosterRequest()).Success.ShouldBeTrue();
            var lastPublishDateTime = Campaigns.FirstOrDefault().Screens.FirstOrDefault().LastPublishDateTime;

            // The last publish date/time should be greater than the default
            lastPublishDateTime.ShouldBeGreaterThan(defaultLastPublishDateTime);

            // The UpdateCampaign method should have been called exactly 1 time
            DataStoreMockObject.Verify(x => x.UpdateCampaign(Campaigns.FirstOrDefault()), Times.Exactly(1));
        }
        public void smoke_test_the_package_validation()
        {
            var theFilename = "fubumvc.core.nuspec";
            var stream = GetType()
                    .Assembly
                    .GetManifestResourceStream(typeof(DataMother), "FubuMVCNuspecTemplate.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            var spec = NugetSpec.ReadFrom(theFilename);
            var service = new PublishingService(new StubSolutionFiles { RootDir = ".".ToFullPath() });

            Exception<RippleFatalError>.ShouldBeThrownBy(() => service.CreatePackage(new PackageParams(spec, new SemanticVersion("1.0.0.0"), ".".ToFullPath(), false)));
        }
Example #9
0
        public void Publishing_Should_Fail_If_Upload_Fails()
        {
            var campaign = Campaigns.FirstOrDefault();

            campaign.Screens = new List <Screen> {
                new Screen()
            };

            // Setup the mock data store to return our campaign
            DataStoreMockObject.Setup(x => x.GetCampaign(It.IsAny <int>())).Returns(campaign);

            PublishingService = new PublishingService(DataStoreMock, new UploadServiceFactory());

            PublishingService.PublishPosterToScreen(new PublishPosterRequest()).Success.ShouldBeFalse();
        }
        public void smoke_test_the_package_validation()
        {
            var theFilename = "fubumvc.core.nuspec";
            var stream      = GetType()
                              .Assembly
                              .GetManifestResourceStream(typeof(DataMother), "FubuMVCNuspecTemplate.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            var spec    = NugetSpec.ReadFrom(theFilename);
            var service = new PublishingService(new StubSolutionFiles {
                RootDir = ".".ToFullPath()
            });

            Exception <RippleFatalError> .ShouldBeThrownBy(() => service.CreatePackage(new PackageParams(spec, new SemanticVersion("1.0.0.0"), ".".ToFullPath(), false)));
        }
Example #11
0
        public void Publishing_Should_Throw_Exception_On_Unknown_Publish_Type()
        {
            var campaign = Campaigns.FirstOrDefault();

            campaign.Screens = new List <Screen> {
                new Screen {
                    PublishType = PublishTypes.Unknown
                }
            };

            // Setup the mock data store to return our campaign
            DataStoreMockObject.Setup(x => x.GetCampaign(It.IsAny <int>())).Returns(campaign);

            PublishingService = new PublishingService(DataStoreMock, new UploadServiceFactory());

            Assert.Throws <ArgumentOutOfRangeException>(() => PublishingService.PublishPosterToScreen(new PublishPosterRequest()));
        }
Example #12
0
        public void Publishing_Should_Fail_For_Campaign_With_No_Matching_Screens()
        {
            var campaign = Campaigns.FirstOrDefault();

            campaign.Screens = new List <Screen> {
                new Screen()
                {
                    Id = 1
                }
            };

            // Setup the mock data store to return our campaign
            DataStoreMockObject.Setup(x => x.GetCampaign(It.IsAny <int>())).Returns(campaign);

            SetupService();

            PublishingService.PublishPosterToScreen(new PublishPosterRequest()).Success.ShouldBeFalse();
        }
Example #13
0
        public void SetUp()
        {
            _loggerMock = new Mock <ILogger <PublishingService> >(MockBehavior.Strict);
            _globalSubscriptionsServiceMock   = new Mock <IGlobalSubscriptionsService>(MockBehavior.Strict);
            _scopedSubscriptionsServiceMock   = new Mock <IScopedSubscriptionsService>(MockBehavior.Strict);
            _subscriptionsMatchingServiceMock = new Mock <ISubscriptionsMatchingService>(MockBehavior.Strict);

            _eventsScopeMock = new Mock <IEventsScope>(MockBehavior.Strict);
            _eventsScopeSubscriptionsFeatureMock = new Mock <IEventsScopeSubscriptionsFeature>(MockBehavior.Strict);

            _publishingService = new PublishingService(
                _loggerMock.Object,
                _globalSubscriptionsServiceMock.Object,
                _scopedSubscriptionsServiceMock.Object,
                _subscriptionsMatchingServiceMock.Object
                );

            Action <object> subscription0HandlerAction = args =>
            {
                ThrowIfEnabled();
                _subscription0Event = args;
            };

            Action <object> subscription1HandlerAction = args =>
            {
                ThrowIfEnabled();
                _subscription1Event = args;
            };

            _subscriptions = new[]
            {
                new Subscription(typeof(object), subscription0HandlerAction.GetInvocationList()[0]),
                new Subscription(typeof(object), subscription1HandlerAction.GetInvocationList()[0]),
            };

            _pipelineEvent = new PipelineEvent(typeof(object));

            _subscription1Event = null;
            _subscription0Event = null;
            _isThrowingEnabled  = false;
        }
        public override bool Execute(BatchPublishInput input)
        {
            Console.WriteLine("Looking for *.nupkg files in " + input.Directory);
            var files = new FileSystem().FindFiles(input.Directory, new FileSet {
                Include = "*.nupkg"
            });

            _count = files.Count();
            _index = 0;

            var publisher = PublishingService.For(SolutionMode.Ripple);

            files.Each(file => {
                _index++;

                RippleLog.Info("Trying to publish {0}, {1} or {2}".ToFormat(file, _index, _count));
                publisher.PublishPackage(input.ServerFlag, file, input.ApiKeyFlag);
            });

            return(true);
        }
Example #15
0
        public void Campaign_Should_Not_Be_Updated_If_Upload_Fails()
        {
            var campaign = Campaigns.FirstOrDefault();

            campaign.Screens = new List <Screen> {
                new Screen()
            };
            var defaultLastPublishDateTime = campaign.Screens.FirstOrDefault().LastPublishDateTime;

            // Setup the mock data store to return our campaign
            DataStoreMockObject.Setup(x => x.GetCampaign(It.IsAny <int>())).Returns(campaign);

            var service             = new PublishingService(DataStoreMock, new UploadServiceFactory());
            var lastPublishDateTime = campaign.Screens.FirstOrDefault().LastPublishDateTime;

            // Success should be false
            service.PublishPosterToScreen(new PublishPosterRequest()).Success.ShouldBeFalse();

            // The last publish date/time should be the default
            lastPublishDateTime.ShouldEqual(defaultLastPublishDateTime);

            // The UpdateCampaign method should have never been called
            DataStoreMockObject.Verify(x => x.UpdateCampaign(new Campaign()), Times.Never());
        }
Example #16
0
        public void Publishing_Should_Fail_For_Campaign_With_No_Screens()
        {
            SetupActiveCampaign();

            PublishingService.PublishPosterToScreen(new PublishPosterRequest()).Success.ShouldBeFalse();
        }
Example #17
0
        public void Publishing_Should_Succeed_For_Campaign_With_Screens()
        {
            SetupActiveCampaignWithScreens();

            PublishingService.PublishPosterToScreen(new PublishPosterRequest()).Success.ShouldBeTrue();
        }
Example #18
0
        public void Publishing_Should_Fail_For_Archived_Campaign()
        {
            SetupArchivedCampaign();

            PublishingService.PublishPosterToScreen(new PublishPosterRequest()).Success.ShouldBeFalse();
        }
Example #19
0
 public TableController()
 {
     this.publishingService    = new PublishingService <Table, DraftTable, TableRepository>(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productStatusService = new ProductStatusService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.helperService        = new HelperService();
 }
Example #20
0
 public PublishingController(PublishingService publishingService)
 {
     _publishingService = publishingService;
 }
Example #21
0
        //Do select listy
        public async Task <ActionResult> GetPublishingsForSelect(string searchString)
        {
            var model = await PublishingService.GetPublishingsForSelect(searchString);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Example #22
0
        public async Task <ActionResult> DeletePublishingPost(int id)
        {
            var result = await PublishingService.Delete(id);

            return(PartialView("_infoPartial", result));
        }
Example #23
0
 public TableController()
 {
     this.publishingService = new PublishingService<Table, DraftTable, TableRepository>(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productStatusService = new ProductStatusService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.helperService = new HelperService();
 }
Example #24
0
 //Do przeladownaia tabeli
 public async Task <ActionResult> IndexPartial()
 => PartialView(await PublishingService.GetAll());
Example #25
0
 public CarrosselController()
 {
     this.productService = new ProductService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.reviewService  = new PublishingService <Review, DraftReview, ReviewRepository>(ContextFactory.GetContext(System.Web.HttpContext.Current));
 }
Example #26
0
        public async Task <ActionResult> EditPublishingPost([Bind(Include = "Id,Name,NameForDisplay,Image,Description")] Publishing publishing)
        {
            var result = await PublishingService.Edit(publishing);

            return(PartialView("_infoPartial", result));
        }
Example #27
0
 public CarrosselController()
 {
     this.productService = new ProductService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.reviewService = new PublishingService<Review, DraftReview, ReviewRepository>(ContextFactory.GetContext(System.Web.HttpContext.Current));
 }
Example #28
0
 public ReviewController()
 {
     this.publishingService = new PublishingService<Review, DraftReview, ReviewRepository>(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productService = new ProductService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.publicationStatusRepository = new PublicationStatusRepository(ContextFactory.GetContext(System.Web.HttpContext.Current));
 }
Example #29
0
 public async Task <ActionResult> DeleteModal(int id)
 => PartialView(await PublishingService.GetById(id));
Example #30
0
 public ReviewController()
 {
     this.publishingService           = new PublishingService <Review, DraftReview, ReviewRepository>(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.productService              = new ProductService(ContextFactory.GetContext(System.Web.HttpContext.Current));
     this.publicationStatusRepository = new PublicationStatusRepository(ContextFactory.GetContext(System.Web.HttpContext.Current));
 }
Example #31
0
 public ItemsController(PublishingService service)
 {
     this.service = service;
 }