public PhotosController(
            IPhotosService photosService,
            IUsersService usersService,
            ITextSplitter textSplitter,
            ISystem system,
            ILogWriterFactory loggerFactory)
        {
            if (textSplitter is null)
            {
                throw new ArgumentNullException(nameof(textSplitter));
            }


            if (loggerFactory is null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            this.photosService = photosService ?? throw new ArgumentNullException(nameof(photosService));
            this.usersService  = usersService ?? throw new ArgumentNullException(nameof(usersService));
            this.system        = system ?? throw new ArgumentNullException(nameof(system));
            logger             = loggerFactory.CreateLogger <PhotosController>();
            lazyClaims         = new Lazy <Claim[]>(() => GetUserClaims());


            var staticAssetHost = new Uri(system.Environment.GetVariable(Constants.EnvironmentVariables.StaticAssetHost));

            this.photoModelConverter = new PhotoModelConverter(staticAssetHost, textSplitter, loggerFactory);
            AWSSDKHandler.RegisterXRayForAllServices();
        }
        public UsersController(
            IUsersService usersService,
            IPhotosService photosService,
            ITextSplitter textSplitter,
            ISystem system,
            ILogWriterFactory logWriterFactory)
        {
            if (textSplitter is null)
            {
                throw new ArgumentNullException(nameof(textSplitter));
            }

            if (system is null)
            {
                throw new ArgumentNullException(nameof(system));
            }

            if (logWriterFactory is null)
            {
                throw new ArgumentNullException(nameof(logWriterFactory));
            }

            this.usersService  = usersService ?? throw new ArgumentNullException(nameof(usersService));
            this.photosService = photosService ?? throw new ArgumentNullException(nameof(photosService));

            var imageAssetHost = new Uri(system.Environment.GetVariable(Constants.EnvironmentVariables.StaticAssetHost));

            this.photoModelConverter = new PhotoModelConverter(imageAssetHost, textSplitter, logWriterFactory);

            AWSSDKHandler.RegisterXRayForAllServices();
        }
        public void ToPublic_HashTag()
        {
            var converter = new PhotoModelConverter(imageAssetHost, new TextSplitter(new HttpHelper(), logWriterFactoryMock.Object), logWriterFactoryMock.Object);

            var publicPhoto = converter.ToPublic(GetPhotoModelWithGivenText(TextWithHashTag));

            publicPhoto.HtmlText.ShouldBe("This is a regular text with a <a href=\"/tags/hashtag\">#hashtag</a> embedded.");
        }
        public void ToPublic_RegularText()
        {
            var converter = new PhotoModelConverter(imageAssetHost, new TextSplitter(new HttpHelper(), logWriterFactoryMock.Object), logWriterFactoryMock.Object);

            var publicPhoto = converter.ToPublic(GetPhotoModelWithGivenText(RegularTextWithNoSpecialFeatures));

            publicPhoto.Text.ShouldBe(RegularTextWithNoSpecialFeatures);
        }
Exemplo n.º 5
0
        public TagsController(
            IPhotosService photosService,
            ITextSplitter textSplitter,
            ISystem system,
            ILogWriterFactory loggerFactory)
        {
            if (system is null)
            {
                throw new ArgumentNullException(nameof(system));
            }

            this.textSplitter  = textSplitter ?? throw new ArgumentNullException(nameof(textSplitter));
            this.loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
            this.photosService = photosService ?? throw new System.ArgumentNullException(nameof(photosService));

            var imageAssetHost = new Uri(system.Environment.GetVariable(Constants.EnvironmentVariables.StaticAssetHost));

            this.photoModelConverter = new PhotoModelConverter(imageAssetHost, textSplitter, loggerFactory);
            lazyClaims = new Lazy <Claim[]>(() => GetUserClaims());

            AWSSDKHandler.RegisterXRayForAllServices();
        }