Exemple #1
0
        public void Test_FillContent()
        {
            var factoryMock = Substitute.For <Func <string> >();
            var optionsMock = Substitute.For <IOptions <MemoryCacheOptions> >();

            optionsMock.Value.Returns(callInfo => new MemoryCacheOptions());
            var           memoryCache  = new MemoryCache(optionsMock);
            ICacheService cacheService = new CacheService(memoryCache);

            IConfiguration _configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();

            var anonymousData = new
            {
                Name       = "Riya",
                Occupation = "Kavin Brother."
            };

            string    content = Helper.GetAdTemplateFileContent();
            IFileRead read    = new FileRead(_configuration, cacheService);

            content = read.FillContent(content, anonymousData);
            Action act = () => content.Should().Contain(anonymousData.Name);

            act.Should().NotThrow();
            Action act1 = () => content.Should().Contain(anonymousData.Occupation);

            act1.Should().NotThrow();
        }
Exemple #2
0
        public void Test_FillContent()
        {
            var anonymousData = new
            {
                Name       = "Riya",
                Occupation = "Kavin Brother."
            };

            string    content = Helper.GetAdTemplateFileContent();
            IFileRead read    = new FileRead();

            content = read.FillContent(content, anonymousData);
            Action act = () => content.Should().Contain(anonymousData.Name);

            act.Should().NotThrow();
            Action act1 = () => content.Should().Contain(anonymousData.Occupation);

            act1.Should().NotThrow();
        }