Ploeh.Samples.Loan.PrimaryApplicantMortgageApplicationProcessor.ProduceOffer C# (CSharp) Méthode

ProduceOffer() public méthode

public ProduceOffer ( MortgageApplication application ) : IEnumerable
application Ploeh.Samples.Loan.DataCollection.MortgageApplication
Résultat IEnumerable
        public IEnumerable<IRendering> ProduceOffer(MortgageApplication application)
        {
            yield return new BoldRendering("Primary applicant:");

            var p = new ApplicantProcessor();
            foreach (var r in p.ProduceRenderings(application.PrimaryApplicant))
                yield return r;
        }

Usage Example

        public void ProduceOfferReturnsCorrectResult(
            string name,
            string street,
            string postalCode,
            string country,
            int yearlyIncome,
            string taxAuthority)
        {
            var sut = new PrimaryApplicantMortgageApplicationProcessor();
            var application = new MortgageApplication
            {
                PrimaryApplicant = new Applicant
                {
                    Contact = new Contact
                    {
                        Name = name,
                        Address = new Address
                        {
                            Street = street,
                            PostalCode = postalCode,
                            Country = country
                        }
                    },
                    YearlyIncome = yearlyIncome,
                    TaxationAuthority = taxAuthority
                }
            };

            var actual = sut.ProduceOffer(application);

            var expected = new IRendering[]
            {
                new BoldRendering("Primary applicant:")
            }
            .Concat(new ApplicantProcessor().ProduceRenderings(
                application.PrimaryApplicant));
            Assert.Equal(expected, actual);
        }
PrimaryApplicantMortgageApplicationProcessor