コード例 #1
0
        public void ProduceOfferReturnsCorrectResult(
            string street,
            string postalCode,
            string country,
            int price,
            int size)
        {
            var sut = new PropertyMortgageApplicationProcessor();
            var application = new MortgageApplication
            {
                Property = new Property
                {
                    Address = new Address
                    {
                        Street = street,
                        PostalCode = postalCode,
                        Country = country
                    },
                    Price = price,
                    Size = size
                }
            };

            var actual = sut.ProduceOffer(application);

            var expected =
                new PropertyProcessor
                {
                    PriceText = "Asking price"
                }
                .ProduceRenderings(application.Property);
            Assert.Equal(expected, actual);
        }
コード例 #2
0
ファイル: PropertyProcessorTests.cs プロジェクト: ploeh/loan
        public void SutDoesNotEqualAnonymousObject()
        {
            var sut = new PropertyProcessor();
            var anonymous = new object();

            var actual = sut.Equals(anonymous);

            Assert.False(actual);
        }
コード例 #3
0
ファイル: PropertyProcessorTests.cs プロジェクト: ploeh/loan
        public void SutEqualsOtherReturnsCorrectResult(
            string priceTextSut,
            string priceTextOther,
            bool expected)
        {
            var sut = new PropertyProcessor { PriceText = priceTextSut };
            var other = new PropertyProcessor { PriceText = priceTextOther };

            var actual = sut.Equals(other);

            Assert.Equal(expected, actual);
        }
コード例 #4
0
        public IEnumerable<IRendering> ProduceOffer(MortgageApplication application)
        {
            yield return new TextRendering("Current property will be sold to finance new property.");
            yield return new LineBreakRendering();

            var p = new PropertyProcessor
            {
                PriceText = "Estimated sales price"
            };
            foreach (var r in p.ProduceRenderings(application.CurrentProperty))
                yield return r;
        }
コード例 #5
0
        public IEnumerable <IRendering> ProduceOffer(MortgageApplication application)
        {
            yield return(new TextRendering("Current property will be sold to finance new property."));

            yield return(new LineBreakRendering());

            var p = new PropertyProcessor
            {
                PriceText = "Estimated sales price"
            };

            foreach (var r in p.ProduceRenderings(application.CurrentProperty))
            {
                yield return(r);
            }
        }
コード例 #6
0
ファイル: PropertyProcessorTests.cs プロジェクト: ploeh/loan
        public void ProduceRenderingsReturnsCorrectResult(
            string street,
            string postalCode,
            string country,
            int price,
            int size,
            string priceText)
        {
            var sut = new PropertyProcessor
            {
                PriceText = priceText
            };
            var property = new Property
            {
                Address = new Address
                {
                    Street = street,
                    PostalCode = postalCode,
                    Country = country
                },
                Price = price,
                Size = size
            };

            IEnumerable<IRendering> actual = sut.ProduceRenderings(property);

            var expected = new IRendering[]
            {
                new BoldRendering("Address:"),
                new TextRendering(
                    " " +
                    street + ", " +
                    postalCode + ", " +
                    country + ". "),
                new LineBreakRendering(),
                new BoldRendering(priceText + ":"),
                new TextRendering(" " + price),
                new LineBreakRendering(),
                new BoldRendering("Size:"),
                new TextRendering(" " + size + " square meters"),
                new LineBreakRendering()
            };
            Assert.Equal(expected, actual);
        }