Пример #1
0
            public void Should_ThrowException_When_NullEntryInDictionaryInHolder()
            {
                var validatorSettings = new ValidatorSettings();

                var holder = new ValidatorSettingsTests.WithTranslation.TestTranslationHolder()
                {
                    Translations = new Dictionary <string, IReadOnlyDictionary <string, string> >()
                    {
                        ["name1"] = new Dictionary <string, string>()
                        {
                            ["k11"] = "v11",
                            ["k12"] = "v12",
                            ["k13"] = null,
                            ["k14"] = "v14",
                        },
                        ["name2"] = new Dictionary <string, string>()
                        {
                            ["k21"] = "v21",
                            ["k22"] = "v22",
                            ["k23"] = "v23",
                            ["k24"] = "v24",
                        }
                    }
                };

                Action action = () => validatorSettings.WithTranslation(holder);

                action.Should().ThrowExactly <ArgumentNullException>();
            }
Пример #2
0
            public void Should_PassAllEntries()
            {
                var validatorSettings = new ValidatorSettings();

                var holder = new ValidatorSettingsTests.WithTranslation.TestTranslationHolder()
                {
                    Translations = new Dictionary <string, IReadOnlyDictionary <string, string> >()
                    {
                        ["name"] = new Dictionary <string, string>()
                        {
                            ["k1"] = "v1",
                            ["k2"] = "v2",
                            ["k3"] = "v3",
                            ["k4"] = "v4",
                        }
                    }
                };

                validatorSettings.WithTranslation(holder);

                validatorSettings.Translations.ShouldBeLikeTranslations(
                    new Dictionary <string, IReadOnlyDictionary <string, string> >()
                {
                    ["name"] = new Dictionary <string, string>()
                    {
                        ["k1"] = "v1",
                        ["k2"] = "v2",
                        ["k3"] = "v3",
                        ["k4"] = "v4",
                    },
                });
            }
Пример #3
0
            public void Should_PassAllEntries_WhenMoreThanOneKeysAtTopLevelDefined()
            {
                var validatorSettings = new ValidatorSettings();

                var holder = new ValidatorSettingsTests.WithTranslation.TestTranslationHolder()
                {
                    Translations = new Dictionary <string, IReadOnlyDictionary <string, string> >()
                    {
                        ["name1"] = new Dictionary <string, string>()
                        {
                            ["k11"] = "v11",
                            ["k12"] = "v12",
                            ["k13"] = "v13",
                            ["k14"] = "v14",
                        },
                        ["name2"] = new Dictionary <string, string>()
                        {
                            ["k21"] = "v21",
                            ["k22"] = "v22",
                            ["k23"] = "v23",
                            ["k24"] = "v24",
                        }
                    }
                };

                validatorSettings.WithTranslation(holder);

                validatorSettings.Translations.ShouldBeLikeTranslations(
                    new Dictionary <string, IReadOnlyDictionary <string, string> >()
                {
                    ["name1"] = new Dictionary <string, string>()
                    {
                        ["k11"] = "v11",
                        ["k12"] = "v12",
                        ["k13"] = "v13",
                        ["k14"] = "v14",
                    },
                    ["name2"] = new Dictionary <string, string>()
                    {
                        ["k21"] = "v21",
                        ["k22"] = "v22",
                        ["k23"] = "v23",
                        ["k24"] = "v24",
                    },
                });
            }
Пример #4
0
            public void Should_ReturnSelf()
            {
                var validatorSettings = new ValidatorSettings();

                var holder = new ValidatorSettingsTests.WithTranslation.TestTranslationHolder()
                {
                    Translations = new Dictionary <string, IReadOnlyDictionary <string, string> >()
                    {
                        ["name1"] = new Dictionary <string, string>()
                        {
                            ["k21"] = "v21",
                        }
                    }
                };

                var result = validatorSettings.WithTranslation(holder);

                result.Should().BeSameAs(validatorSettings);
            }