Exemplo n.º 1
0
        public void UnknownPlaceholder_NoUnknowns_NoKnowns()
        {
            var sut = new AllowedPlaceholderValidator();

            var use = $"FOO Blah blah blah  BAR";

            var(isValid, unknownList) = sut.ContainsUnknownPlaceholders(use);

            Assert.IsTrue(isValid);
            Assert.IsNotNull(unknownList);
            Assert.IsFalse(unknownList.Any());
        }
Exemplo n.º 2
0
        public void UnknownPlaceholder_NoUnknowns_SomeKnowns()
        {
            var sut = new AllowedPlaceholderValidator();

            var use = $"FOO  {Placeholder.PropertyName}, {Placeholder.PropertyNameWithSpaces}, {Placeholder.PropertyType}  BAR";

            var(isValid, unknownList) = sut.ContainsUnknownPlaceholders(use);

            Assert.IsTrue(isValid);
            Assert.IsNotNull(unknownList);
            Assert.IsFalse(unknownList.Any());
        }
Exemplo n.º 3
0
        public void UnknownPlaceholder_OneUnknown_SomeKnowns()
        {
            var sut = new AllowedPlaceholderValidator();

            var unknownPlaceholder = "$unknown$";

            var use = $"{unknownPlaceholder},  {Placeholder.PropertyName}, {Placeholder.PropertyNameWithSpaces}, {Placeholder.PropertyType}";

            var(isValid, unknownList) = sut.ContainsUnknownPlaceholders(use);

            Assert.IsFalse(isValid);
            Assert.IsNotNull(unknownList);
            Assert.AreEqual(1, unknownList.Count);
            Assert.AreEqual(unknownPlaceholder, unknownList[0]);
        }
Exemplo n.º 4
0
        public void UnknownPlaceholder_OneUnknown_NoKnowns()
        {
            var sut = new AllowedPlaceholderValidator();

            var unknownPlaceholder = "$unknown$";

            var use = $"blah blah {unknownPlaceholder} $$ bjekwbfjkewbj";

            var(isValid, unknownList) = sut.ContainsUnknownPlaceholders(use);

            Assert.IsFalse(isValid);
            Assert.IsNotNull(unknownList);
            Assert.AreEqual(1, unknownList.Count);
            Assert.AreEqual(unknownPlaceholder, unknownList[0]);
        }
Exemplo n.º 5
0
        public void UnknownPlaceholder_TwoUnknows_NoKnowns()
        {
            var sut = new AllowedPlaceholderValidator();

            var unknownPlaceholder1 = "$unknown1$";
            var unknownPlaceholder2 = "$unknown2$";

            var use = $"{unknownPlaceholder1}, {unknownPlaceholder2}, $$ bjekwbfjkewbj";

            var(isValid, unknownList) = sut.ContainsUnknownPlaceholders(use);

            Assert.IsFalse(isValid);
            Assert.IsNotNull(unknownList);
            Assert.AreEqual(2, unknownList.Count);
            Assert.AreEqual(unknownPlaceholder1, unknownList[0]);
            Assert.AreEqual(unknownPlaceholder2, unknownList[1]);
        }