public void DisplayTrafficInfo_NullLocation() { var ex = Assert.Throws <ArgumentNullException>(() => { TrafficService.DisplayTrafficInfo(null, happyDateAndTime); }); Assert.That(ex.Message, Is.EqualTo("Location is required.")); }
public void DisplayTrafficInfo_InvalidDateTime() { var ex = Assert.Throws <ArgumentOutOfRangeException>(() => { TrafficService.DisplayTrafficInfo(happyLocation, invalidDateAndTime); }); Assert.That(ex.Message, Is.EqualTo("Invalid dateAndTime input.")); }
public void DisplayTrafficInfo_Happy() { TrafficDataModel expected = new TrafficDataModel() { Location = happyLocation, DateAndTime = happyDateAndTime, TrafficAverageSpeed = 35.4, TrafficDensity = 0.24, TruckPercentage = 0.15, NumberOfAccidents = 5 }; var actual = TrafficService.DisplayTrafficInfo(happyLocation, happyDateAndTime); Assert.AreEqual(expected.Location, actual.Location); Assert.AreEqual(expected.DateAndTime, actual.DateAndTime); Assert.AreEqual(expected.TrafficAverageSpeed, actual.TrafficAverageSpeed); Assert.AreEqual(expected.TrafficDensity, actual.TrafficDensity); Assert.AreEqual(expected.TruckPercentage, actual.TruckPercentage); Assert.AreEqual(expected.NumberOfAccidents, actual.NumberOfAccidents); }