public void Add_Should_ThrowException_When_NullArgs(string name, string messageKey, string tralsnation)
        {
            var translationCompiler = new TranslationCompiler();

            Action action = () => translationCompiler.Add(name, messageKey, tralsnation);

            action.Should().Throw <ArgumentNullException>();
        }
        /// <summary>
        /// Adds translation entry for error messages.
        /// </summary>
        /// <param name="name">Translation name, e.g., "English".</param>
        /// <param name="messageKey">Message key. For custom messages - same content that is in WithMessage/WithExtraMessage. For built-in messages, find their keys in the docs (e.g., 'Texts.Email' for Email string rule).</param>
        /// <param name="translation">Translation content.</param>
        /// <returns>Settings fluent API builder - output.</returns>
        public ValidatorSettings WithTranslation(string name, string messageKey, string translation)
        {
            ThrowIfLocked();

            _translationCompiler.Add(name, messageKey, translation);

            return(this);
        }
        public void Add_Should_AddTranslation_ManyTimes_SameTranslation()
        {
            var translationCompiler = new TranslationCompiler();

            translationCompiler.Add("name", "key1", "value1");
            translationCompiler.Add("name", "key2", "value2");

            translationCompiler.Translations.Keys.Should().HaveCount(1);
            translationCompiler.Translations.Keys.Should().Contain("name");

            translationCompiler.Translations["name"].Keys.Should().HaveCount(2);

            translationCompiler.Translations["name"].Keys.Should().Contain("key1");
            translationCompiler.Translations["name"]["key1"].Should().Be("value1");

            translationCompiler.Translations["name"].Keys.Should().Contain("key2");
            translationCompiler.Translations["name"]["key2"].Should().Be("value2");
        }
        public void Add_Should_AddTranslation()
        {
            var translationCompiler = new TranslationCompiler();

            translationCompiler.Add("name", "key", "value");

            translationCompiler.Translations.Keys.Should().HaveCount(1);
            translationCompiler.Translations.Keys.Should().Contain("name");
            translationCompiler.Translations["name"].Keys.Should().HaveCount(1);
            translationCompiler.Translations["name"].Keys.Should().Contain("key");
            translationCompiler.Translations["name"]["key"].Should().Be("value");
        }
        public void Add_Should_AddTranslation_Should_OverwriteValue_WhenSameKeysInDifferentDictionaries()
        {
            var translationCompiler = new TranslationCompiler();

            translationCompiler.Add("name1", "key", "value1");
            translationCompiler.Add("name2", "key", "value2");

            translationCompiler.Add("name2", "key", "VALUE_2");

            translationCompiler.Translations.Keys.Should().HaveCount(2);
            translationCompiler.Translations.Keys.Should().Contain("name1");
            translationCompiler.Translations.Keys.Should().Contain("name2");

            translationCompiler.Translations["name1"].Keys.Should().HaveCount(1);
            translationCompiler.Translations["name1"].Keys.Should().Contain("key");
            translationCompiler.Translations["name1"]["key"].Should().Be("value1");

            translationCompiler.Translations["name2"].Keys.Should().HaveCount(1);
            translationCompiler.Translations["name2"].Keys.Should().Contain("key");
            translationCompiler.Translations["name2"]["key"].Should().Be("VALUE_2");
        }
        public void Add_Should_AddTranslation_Should_OverwriteValue()
        {
            var translationCompiler = new TranslationCompiler();

            translationCompiler.Add("name1", "key1", "value1");
            translationCompiler.Add("name2", "key2", "value2");

            translationCompiler.Add("name2", "key2", "VALUE_2");

            translationCompiler.Translations.Keys.Should().HaveCount(2);
            translationCompiler.Translations.Keys.Should().Contain("name1");
            translationCompiler.Translations.Keys.Should().Contain("name2");

            translationCompiler.Translations["name1"].Keys.Should().HaveCount(1);
            translationCompiler.Translations["name1"].Keys.Should().Contain("key1");
            translationCompiler.Translations["name1"]["key1"].Should().Be("value1");

            translationCompiler.Translations["name2"].Keys.Should().HaveCount(1);
            translationCompiler.Translations["name2"].Keys.Should().Contain("key2");
            translationCompiler.Translations["name2"]["key2"].Should().Be("VALUE_2");
        }