public void SuppressAttributeIsNotIgnored() { TargetClassDefinition classDefinition = DefinitionObjectMother.GetActiveTargetClassDefinition_Force(typeof(ClassWithSuppressAttribute)); Assert.That(classDefinition.CustomAttributes.ContainsKey(typeof(SuppressAttributesAttribute)), Is.True); }
public void Merge() { IValidationLog sourceLog = new DefaultValidationLog(); var exception = new Exception(); TargetClassDefinition bt1 = DefinitionObjectMother.GetActiveTargetClassDefinition(typeof(BaseType1)); TargetClassDefinition bt2 = DefinitionObjectMother.GetActiveTargetClassDefinition_Force(typeof(BaseType2)); TargetClassDefinition bt3 = DefinitionObjectMother.GetActiveTargetClassDefinition(typeof(BaseType3)); TargetClassDefinition bt4 = DefinitionObjectMother.GetActiveTargetClassDefinition_Force(typeof(BaseType4)); sourceLog.ValidationStartsFor(bt1); sourceLog.Succeed(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "Success", "Success")); sourceLog.Warn(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "Warn", "Warn")); sourceLog.Fail(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "Fail", "Fail")); sourceLog.UnexpectedException(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "Except", "Except"), exception); sourceLog.ValidationEndsFor(bt1); sourceLog.ValidationStartsFor(bt4); sourceLog.Succeed(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "Success2", "Success2")); sourceLog.Warn(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "Warn2", "Warn2")); sourceLog.Fail(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "Fail2", "Fail2")); sourceLog.UnexpectedException(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "Except2", "Except2"), exception); sourceLog.ValidationEndsFor(bt4); IValidationLog resultLog = new DefaultValidationLog(); resultLog.ValidationStartsFor(bt2); resultLog.Succeed(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "0", "0")); resultLog.Warn(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "1", "1")); resultLog.Fail(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "2", "2")); resultLog.UnexpectedException(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "3", "3"), exception); resultLog.ValidationEndsFor(bt2); resultLog.ValidationStartsFor(bt1); resultLog.Succeed(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "4", "4")); resultLog.Warn(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "5", "5")); resultLog.Fail(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "6", "6")); resultLog.UnexpectedException(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "7", "7"), exception); resultLog.ValidationEndsFor(bt1); resultLog.ValidationStartsFor(bt3); resultLog.Succeed(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "8", "8")); resultLog.Warn(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "9", "9")); resultLog.Fail(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "10", "10")); resultLog.UnexpectedException(new DelegateValidationRule <TargetClassDefinition> (delegate { }, "11", "11"), exception); resultLog.ValidationEndsFor(bt3); var logData = resultLog.GetData(); logData.Add(sourceLog.GetData()); Assert.That(logData.GetNumberOfSuccesses(), Is.EqualTo(5)); Assert.That(logData.GetNumberOfWarnings(), Is.EqualTo(5)); Assert.That(logData.GetNumberOfFailures(), Is.EqualTo(5)); Assert.That(logData.GetNumberOfUnexpectedExceptions(), Is.EqualTo(5)); var results = new List <ValidationResult> (logData.GetResults()); Assert.That(results.Count, Is.EqualTo(4)); Assert.That(results[0].ValidatedDefinition, Is.EqualTo(bt2)); Assert.That(results[0].Successes.Count, Is.EqualTo(1)); Assert.That(results[0].Failures.Count, Is.EqualTo(1)); Assert.That(results[0].Warnings.Count, Is.EqualTo(1)); Assert.That(results[0].Exceptions.Count, Is.EqualTo(1)); Assert.That(results[1].ValidatedDefinition, Is.EqualTo(bt1)); Assert.That(results[1].Successes.Count, Is.EqualTo(2)); Assert.That(results[1].Successes[0].Message, Is.EqualTo("4")); Assert.That(results[1].Successes[1].Message, Is.EqualTo("Success")); Assert.That(results[1].Warnings.Count, Is.EqualTo(2)); Assert.That(results[1].Warnings[0].Message, Is.EqualTo("5")); Assert.That(results[1].Warnings[1].Message, Is.EqualTo("Warn")); Assert.That(results[1].Failures.Count, Is.EqualTo(2)); Assert.That(results[1].Failures[0].Message, Is.EqualTo("6")); Assert.That(results[1].Failures[1].Message, Is.EqualTo("Fail")); Assert.That(results[1].Exceptions.Count, Is.EqualTo(2)); Assert.That(results[1].Exceptions[0].Exception, Is.EqualTo(exception)); Assert.That(results[1].Exceptions[1].Exception, Is.EqualTo(exception)); Assert.That(results[2].ValidatedDefinition, Is.EqualTo(bt3)); Assert.That(results[2].Successes.Count, Is.EqualTo(1)); Assert.That(results[2].Failures.Count, Is.EqualTo(1)); Assert.That(results[2].Warnings.Count, Is.EqualTo(1)); Assert.That(results[2].Exceptions.Count, Is.EqualTo(1)); Assert.That(results[3].ValidatedDefinition, Is.EqualTo(bt4)); Assert.That(results[3].Successes.Count, Is.EqualTo(1)); Assert.That(results[3].Successes[0].Message, Is.EqualTo("Success2")); Assert.That(results[3].Warnings.Count, Is.EqualTo(1)); Assert.That(results[3].Warnings[0].Message, Is.EqualTo("Warn2")); Assert.That(results[3].Failures.Count, Is.EqualTo(1)); Assert.That(results[3].Failures[0].Message, Is.EqualTo("Fail2")); Assert.That(results[3].Exceptions.Count, Is.EqualTo(1)); Assert.That(results[3].Exceptions[0].Exception, Is.EqualTo(exception)); }