コード例 #1
0
 public void should_not_charge_given_reading_amount_not_changed()
 {
     var subject = new BusinessSite();
     subject.AddReading(new Reading(10, new DateTime(1997, 1, 1)));
     subject.AddReading(new Reading(10, new DateTime(1997, 2, 1)));
     Assert.Equal(new Dollars(0), subject.Charge());
 }
コード例 #2
0
 public void should_charge_7_33_given_reading_amount_increase_101()
 {
     var subject = new BusinessSite();
     subject.AddReading(new Reading(1000, new DateTime(1997, 1, 1)));
     subject.AddReading(new Reading(1101, new DateTime(1997, 2, 1)));
     Assert.Equal(new Dollars(7.33), subject.Charge());
 }
コード例 #3
0
 public void should_charge_given_reading_amount_max_increaseds()
 {
     var subject = new BusinessSite();
     subject.AddReading(new Reading(0, new DateTime(1997, 1, 1)));
     subject.AddReading(new Reading(int.MaxValue, new DateTime(1997, 2, 1)));
     Assert.Equal(new Dollars(1.5220290473E8), subject.Charge());
 }
コード例 #4
0
 public void should_charge_14_5_given_reading_amount_increase_201()
 {
     var subject = new BusinessSite();
     subject.AddReading(new Reading(50, new DateTime(1997, 1, 1)));
     subject.AddReading(new Reading(251, new DateTime(1997, 2, 1)));
     Assert.Equal(new Dollars(14.55), subject.Charge());
 }
コード例 #5
0
 public void should_throw_exception_given_no_reading()
 {
     var subject = new BusinessSite();
     Assert.Throws<NullReferenceException>(() => subject.Charge());
 }