Exemplo n.º 1
0
        public void Test(string value, AlignmentType alignmentType, int errorCount)
        {
            string tagString = $"aspf={value}";
            Aspf   tag       = (Aspf)_parser.Parse(tagString, value);

            Assert.That(tag.Value, Is.EqualTo($"{tagString};"));
            Assert.That(tag.AlignmentType, Is.EqualTo(alignmentType));
            Assert.That(tag.ErrorCount, Is.EqualTo(errorCount));
        }
Exemplo n.º 2
0
        public Tag Parse(string tag, string value)
        {
            AlignmentType alignmentType;

            if (!value.TryParseExactEnum(out alignmentType))
            {
                alignmentType = AlignmentType.Unknown;
            }

            Aspf aspf = new Aspf(tag, alignmentType);

            if (alignmentType == AlignmentType.Unknown)
            {
                string errorMessage = string.Format(DmarcParserResource.InvalidValueErrorMessage, Tag, value);
                aspf.AddError(new Error(ErrorType.Error, errorMessage));
            }

            return(aspf);
        }