Exemple #1
0
        public void EntrantWithContactValidationErrorsIsNotValid()
        {
            // Arrange
            Mock<IEntrantContact> contact = new Mock<IEntrantContact>();
            ValidationErrors errors = new ValidationErrors();
            errors.Add("invalidProperty");
            contact.Setup(a => a.ValidationErrors).Returns(errors);
            contact.Setup(a => a.IsValid).Returns(false);

            Entrant entrant = new Entrant();
            entrant.Answer = CompetitionAnswer.A;
            entrant.Source = EntrantSource.Sms;
            entrant.Contact = contact.Object;
            
            // Act
            bool isValid = entrant.IsValid;

            // Assert
            Assert.IsFalse(isValid);
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EntityBase" /> class.
 /// </summary>
 protected EntityBase()
 {
     _validationErrors = new ValidationErrors();
 }