public void SponsorsAreOrderedPaymentDate_WhenSponsoringTheSameAmount()
        {
            var earlySponsor = new Sponsor { SponsorshipAmount = 100, PaymentDate = new DateTime(2015, 4, 1) };
            var sponsor = new Sponsor { SponsorshipAmount = 100, PaymentDate = new DateTime(2015, 4, 15) };
            var lastMinuteSponsor = new Sponsor { SponsorshipAmount = 100, PaymentDate = new DateTime(2015, 4, 30) };
            var sorter = new DefaultSponsorSorter();

            var sortedSponsors = sorter.Sort(new[] { sponsor, lastMinuteSponsor, earlySponsor });

            Assert.That(sortedSponsors, Is.EqualTo(new[] { earlySponsor, sponsor, lastMinuteSponsor }));
        }
        public void SponsorsAreOrderedByAmount_WithHighestAmountFirst()
        {
            var poorSponsor = new Sponsor { SponsorshipAmount = 100 };
            var averageSponsor = new Sponsor { SponsorshipAmount = 1000 };
            var richSponsor = new Sponsor { SponsorshipAmount = 100000 };
            var sorter = new DefaultSponsorSorter();

            var sortedSponsors = sorter.Sort(new[] { averageSponsor, richSponsor, poorSponsor });

            Assert.That(sortedSponsors, Is.EqualTo(new[] { richSponsor, averageSponsor, poorSponsor }));
        }
예제 #3
0
        public void SponsorsAreOrderedPaymentDate_WhenSponsoringTheSameAmount()
        {
            var earlySponsor = new Sponsor {
                SponsorshipAmount = 100, PaymentDate = new DateTime(2015, 4, 1)
            };
            var sponsor = new Sponsor {
                SponsorshipAmount = 100, PaymentDate = new DateTime(2015, 4, 15)
            };
            var lastMinuteSponsor = new Sponsor {
                SponsorshipAmount = 100, PaymentDate = new DateTime(2015, 4, 30)
            };
            var sorter = new DefaultSponsorSorter();

            var sortedSponsors = sorter.Sort(new[] { sponsor, lastMinuteSponsor, earlySponsor });

            Assert.That(sortedSponsors, Is.EqualTo(new[] { earlySponsor, sponsor, lastMinuteSponsor }));
        }
예제 #4
0
        public void SponsorsAreOrderedByAmount_WithHighestAmountFirst()
        {
            var poorSponsor = new Sponsor {
                SponsorshipAmount = 100
            };
            var averageSponsor = new Sponsor {
                SponsorshipAmount = 1000
            };
            var richSponsor = new Sponsor {
                SponsorshipAmount = 100000
            };
            var sorter = new DefaultSponsorSorter();

            var sortedSponsors = sorter.Sort(new[] { averageSponsor, richSponsor, poorSponsor });

            Assert.That(sortedSponsors, Is.EqualTo(new[] { richSponsor, averageSponsor, poorSponsor }));
        }