public void Rate_WhenBMWWithDeductibleLessThan500_SetRatingTo1000() { var policy = new Policy { Type = PolicyType.Auto, Make = "BMW", Deductible = 250 }; var autoPolicyRater = new AutoPolicyRater(new Mock <ILogger>().Object); var result = autoPolicyRater.Rate(policy); Assert.That(result, Is.EqualTo(1000)); }
public void Rate_WhenGivenPolicyWithoutMake_LogMakeRequiredMessage() { var policy = new Policy { Type = PolicyType.Auto }; var logger = new Mock <ILogger>(); var autoPolicyRater = new AutoPolicyRater(logger.Object); autoPolicyRater.Rate(policy); logger.Verify(l => l.Log("Auto policy must specify Make")); }
public void LogsMakeRequiredMessageGivenPolicyWithoutMake() { var policy = new Policy() { Type = "Auto" }; var logger = new FakeLogger(); var rater = new AutoPolicyRater(null); rater.Logger = logger; rater.Rate(policy); Assert.Equal("Auto policy must specify Make", logger.LoggedMessages.Last()); }
public void SetsRatingTo1000forBMWWith250Deductible() { var policy = new Policy() { Type = PolicyType.Auto, Make = "BMW", Deductible = 250m }; var ratingUpdater = new FakeRatingUpdater(); var rater = new AutoPolicyRater(ratingUpdater); rater.Rate(policy); Assert.Equal(1000m, ratingUpdater.NewRating.Value); }
public void SetRatingTo1000ForBMWWith250Deductible() { var policy = new Policy() { Type = PolicyType.Auto, Make = "BMW", Deductible = 250m }; var rater = new AutoPolicyRater(_logger); decimal rating = rater.Rate(policy); Assert.Equal(1000m, rating); }
public void LogMakeRequiredMessageGivenPolicyWithoutMake() { var policy = new Policy { Type = PolicyType.Auto }; var logger = new FakeLogger();//use Moq instead of dummy implementations var rater = new AutoPolicyRater(null); rater.Logger = logger; rater.Rate(policy); Assert.Equal("Auto policy must specify Make", logger.LoggedMessages.Last()); }
public void SetsRatingTo900ForBMWWith500Deductible() { var policy = new Policy() { Type = "Auto", Make = "BMW", Deductible = 500m }; var ratingUpdater = new FakeRatingUpdater(); var rater = new AutoPolicyRater(ratingUpdater); rater.Rate(policy); Assert.Equal(900m, ratingUpdater.NewRating.Value); }
public void LogsMakeRequiredMessageGivenPolicyWithoutMakeMoq() { var mock = new Mock <ILogger>(); var policy = new Policy() { Type = "Auto" }; //var logger = new FakeLogger(); var rater = new AutoPolicyRater(null); rater.Logger = mock.Object; rater.Rate(policy); mock.Verify(m => m.Log("Auto policy must specify Make"), Times.Once()); }
public void SetsRatingTo900ForBMWWith500Deductible() { var policy = new Policy() { Type = "Auto", Make = "BMW", Deductible = 500m }; var logger = new FakeLogger(); var rater = new AutoPolicyRater(logger); var result = rater.Rate(policy); Assert.Equal(900m, result); }
public void SetsRatingTo1000ForBMWWith250Deductible() { var policy = new Policy() { Type = "Auto", Make = "BMW", Deductible = 250m }; var logger = new FakeLogger(); var rater = new AutoPolicyRater(logger); rater.Rate(policy); Assert.Equal(1000m, ); }
public void SetRatingTo1000ForBMWWith250DeductibleMoq() { var policy = new Policy() { Type = "Auto", Make = "BMW", Deductible = 250m }; var moq = new Mock <IRatingUpdater>(); var rater = new AutoPolicyRater(moq.Object); rater.Rate(policy); moq.Verify(moq => moq.UpdateRating(1000m), Times.Once()); }
public void SetsRatingTo1000ForBMWWith250Deductible() { //Given var policy = new Policy() { Type = "Auto", Make = "BMW", Deductible = 250m }; var logger = new FakeLogger(); var rater = new AutoPolicyRater(logger); //When var result = rater.Rate(policy); //Then Assert.Equal(1000m, result); }