コード例 #1
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 }));
        }
コード例 #2
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 }));
        }
コード例 #3
0
 public void AddSponsor(Sponsor sponsor)
 {
     db.Sponsors.Insert(sponsor);
 }
コード例 #4
0
 private SponsorModel CreateSponsorModel(Sponsor sponsor)
 {
     return new SponsorModel
     {
         SponsorId = sponsor.SponsorId,
         Name = sponsor.Name,
         Url = sponsor.Url,
         SponsorshipAmount = sponsor.SponsorshipAmount,
         PaymentDate = sponsor.PaymentDate,
         ShowPublicly = sponsor.ShowPublicly
     };
 }