public void Evaluate_ProducerHasOverseasContactInFrance_Passes() { // Arrange EnsureAnOverseasProducerIsNotBasedInTheUK rule = new EnsureAnOverseasProducerIsNotBasedInTheUK(); addressType address = new addressType(); address.country = countryType.FRANCE; contactDetailsType overseasContact = new contactDetailsType(); overseasContact.address = address; overseasProducerType overseasProducer = new overseasProducerType(); overseasProducer.overseasContact = overseasContact; authorisedRepresentativeType authorisedRepresentative = new authorisedRepresentativeType(); authorisedRepresentative.overseasProducer = overseasProducer; producerType producer = new producerType(); producer.authorisedRepresentative = authorisedRepresentative; // Act RuleResult result = rule.Evaluate(producer); // Assert Assert.Equal(true, result.IsValid); }
public void Evaluate_ProducerHasOverseaseContactInEngland_FailsWithError() { // Arrange EnsureAnOverseasProducerIsNotBasedInTheUK rule = new EnsureAnOverseasProducerIsNotBasedInTheUK(); addressType address = new addressType(); address.country = countryType.UKENGLAND; contactDetailsType overseasContact = new contactDetailsType(); overseasContact.address = address; overseasProducerType overseasProducer = new overseasProducerType(); overseasProducer.overseasContact = overseasContact; authorisedRepresentativeType authorisedRepresentative = new authorisedRepresentativeType(); authorisedRepresentative.overseasProducer = overseasProducer; producerType producer = new producerType(); producer.authorisedRepresentative = authorisedRepresentative; // Act RuleResult result = rule.Evaluate(producer); // Assert Assert.Equal(false, result.IsValid); Assert.Equal(ErrorLevel.Error, result.ErrorLevel); }
public void Evaluate_ProducerHasNoOverseasContact_Passes() { // Arrange EnsureAnOverseasProducerIsNotBasedInTheUK rule = new EnsureAnOverseasProducerIsNotBasedInTheUK(); overseasProducerType overseasProducer = new overseasProducerType(); overseasProducer.overseasContact = null; authorisedRepresentativeType authorisedRepresentative = new authorisedRepresentativeType(); authorisedRepresentative.overseasProducer = overseasProducer; producerType producer = new producerType(); producer.authorisedRepresentative = authorisedRepresentative; // Act RuleResult result = rule.Evaluate(producer); // Assert Assert.Equal(true, result.IsValid); }
public void Evaluate_ProducerHasNoOverseasContact_Passes() { // Arrange EnsureAnOverseasProducerIsNotBasedInTheUK rule = new EnsureAnOverseasProducerIsNotBasedInTheUK(); overseasProducerType overseasProducer = new overseasProducerType(); overseasProducer.overseasContact = null; authorisedRepresentativeType authorisedRepresentative = new authorisedRepresentativeType(); authorisedRepresentative.overseasProducer = overseasProducer; producerType producer = new producerType(); producer.authorisedRepresentative = authorisedRepresentative; // Act RuleResult result = rule.Evaluate(producer); // Assert Assert.Equal(true, result.IsValid); }
public void Evaluate_ProducerHasOverseasContactInFrance_Passes() { // Arrange EnsureAnOverseasProducerIsNotBasedInTheUK rule = new EnsureAnOverseasProducerIsNotBasedInTheUK(); addressType address = new addressType(); address.country = countryType.FRANCE; contactDetailsType overseasContact = new contactDetailsType(); overseasContact.address = address; overseasProducerType overseasProducer = new overseasProducerType(); overseasProducer.overseasContact = overseasContact; authorisedRepresentativeType authorisedRepresentative = new authorisedRepresentativeType(); authorisedRepresentative.overseasProducer = overseasProducer; producerType producer = new producerType(); producer.authorisedRepresentative = authorisedRepresentative; // Act RuleResult result = rule.Evaluate(producer); // Assert Assert.Equal(true, result.IsValid); }
public void Evaluate_ProducerHasOverseaseContactInEngland_FailsWithError() { // Arrange EnsureAnOverseasProducerIsNotBasedInTheUK rule = new EnsureAnOverseasProducerIsNotBasedInTheUK(); addressType address = new addressType(); address.country = countryType.UKENGLAND; contactDetailsType overseasContact = new contactDetailsType(); overseasContact.address = address; overseasProducerType overseasProducer = new overseasProducerType(); overseasProducer.overseasContact = overseasContact; authorisedRepresentativeType authorisedRepresentative = new authorisedRepresentativeType(); authorisedRepresentative.overseasProducer = overseasProducer; producerType producer = new producerType(); producer.authorisedRepresentative = authorisedRepresentative; // Act RuleResult result = rule.Evaluate(producer); // Assert Assert.Equal(false, result.IsValid); Assert.Equal(ErrorLevel.Error, result.ErrorLevel); }