예제 #1
0
        public void ShouldGetContentByCultureUnknownCulture()
        {
            var container = new CultureContentContainer();
            var sut       = new ContentHandler(container);

            //set a couple of cultures
            sut.AddCultureContents(new Dictionary <CultureInfo, ICultureContent> {
                { new CultureInfo("nl-NL"), null },
                { new CultureInfo("en-GB"), null }
            });
            Assert.Throws <IndexOutOfRangeException>(() => sut.GetContentByCulture(new CultureInfo("ru-KZ")));
        }
예제 #2
0
        public void ShouldGetHeaderContent()
        {
            //parse the content tested in the YamlContentParser, do not mock in this case
            var container = new CultureContentContainer();
            var sut       = new ContentHandler(container);
            var dutch     = new CultureInfo("nl-NL");

            sut.TranslateParsedYamlToContent(dutch, YamlParser.RenderYamlToObject(ContentYamlTest3.Body));
            var cultureContent = sut.GetContentByCulture(dutch);

            Assert.Equal("#Zorgtoeslag", cultureContent.GetContent("berekening.header", "titel"));
            Assert.Equal("##Proefbekrekening", cultureContent.GetContent("berekening.header", "ondertitel"));
        }
예제 #3
0
        public void ShouldTransLateParsedContentToContent()
        {
            //parse the content tested in the YamlContentParser, do not mock in this case
            var container = new CultureContentContainer();
            var sut       = new ContentHandler(container);
            var dutch     = new CultureInfo("nl-NL");

            sut.TranslateParsedYamlToContent(dutch, YamlParser.RenderYamlToObject(ContentYamlTest1.Body));
            var cultureContent = sut.GetContentByCulture(dutch);

            Assert.Equal("Indien u niet zeker weet wat uw woonsituatie is, kijk dan op de website van de Belastingdienst.",
                         cultureContent.GetContent("stap.woonsituatie", FormElementContentType.Description));
        }
예제 #4
0
        public void ShouldGetContentByCulture()
        {
            var container = new CultureContentContainer();
            var sut       = new ContentHandler(container);

            //set a couple of cultures
            sut.AddCultureContents(new Dictionary <CultureInfo, ICultureContent> {
                { new CultureInfo("nl-NL"), null },
                { new CultureInfo("ru-KZ"), new CultureContent() },
                { new CultureInfo("en-GB"), null }
            });
            sut.SetDefaultCulture(new CultureInfo("ru-Kz"));
            Assert.NotNull(sut.GetContentByCulture(new CultureInfo("ru-Kz")));
        }
예제 #5
0
        public void ShouldTransLateParsedContentToContentForMultipleKeys()
        {
            //parse the content tested in the YamlContentParser, do not mock in this case
            var container = new CultureContentContainer();
            var sut       = new ContentHandler(container);
            var dutch     = new CultureInfo("nl-NL");

            sut.TranslateParsedYamlToContent(dutch, YamlParser.RenderYamlToObject(ContentYamlTest2.Body));
            var cultureContent = sut.GetContentByCulture(dutch);

            Assert.Throws <IndexOutOfRangeException>(() => cultureContent.GetContent("stap.woonsituatie.keuze.alleenstaande, multipleKeys", FormElementContentType.Description));
            Assert.Equal("Alleenstaande", cultureContent.GetContent("stap.woonsituatie.keuze.alleenstaande", FormElementContentType.Description));
            Assert.Equal("Alleenstaande", cultureContent.GetContent("multipleKeys", FormElementContentType.Description));
        }