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")));
        }
        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"));
        }
        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));
        }
        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")));
        }
        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));
        }