예제 #1
0
        public async Task TestWithoutErrors(Qualifier?qualifier, bool root)
        {
            List <Term> terms = qualifier.HasValue
                ? new List <Term> {
                new All(qualifier.Value, string.Empty, true, false)
            }
                : new List <Term>();

            SpfRecord record = new SpfRecord(new List <string>(), new Version(string.Empty, true), terms, new List <Message>(), root);

            ShouldHaveHardFailAllEnabled rule = new ShouldHaveHardFailAllEnabled(new QualifierExplainer());

            List <Message> messages = await rule.Evaluate(record);

            Assert.That(messages.Any(), Is.False);
        }
예제 #2
0
        public void Test(SpfRecord spfRecord, string expectedError, ErrorType?expectedErrorType)
        {
            ShouldHaveHardFailAllEnabled shouldHaveHardFailAllEnabled = new ShouldHaveHardFailAllEnabled(new QualifierExplainer());

            bool hasError = shouldHaveHardFailAllEnabled.IsErrored(spfRecord, out Error error);

            if (expectedError == null)
            {
                Assert.That(error, Is.Null);
                Assert.That(hasError, Is.False);
            }
            else
            {
                Assert.That(hasError, Is.True);
                Assert.That(error.ErrorType, Is.EqualTo(expectedErrorType.Value));
                Assert.That(error.Message, Is.EqualTo(expectedError));
            }
        }
예제 #3
0
 public void SetUp()
 {
     _rule = new ShouldHaveHardFailAllEnabled(FakeItEasy.A.Fake <IQualifierExplainer>());
 }