public void CheckIfPackageNumbersAreNumeric() { ShipmentPackageGenerator shipmentPackageGenerator = new ShipmentPackageGenerator(_baseFixture.MockConfiguration); List <ShipmentPackageDTO> packages = shipmentPackageGenerator.GenerateRandomShipmentPackages(); Assert.True(packages.Select(p => p.PackageNumber).ConvertToInt().Count() == packages.Count()); }
public void CheckIfAddressNumbersAreUnique() { ShipmentPackageGenerator shipmentPackageGenerator = new ShipmentPackageGenerator(_baseFixture.MockConfiguration); List <ShipmentPackageDTO> packages = shipmentPackageGenerator.GenerateRandomShipmentPackages(); Assert.True(packages.Select(p => p.DeliveryAddressNumber).Distinct().Count() == packages.Count()); }
public void CheckIfPackageWeightsAreBetweenTenAndTwentyFive() { ShipmentPackageGenerator shipmentPackageGenerator = new ShipmentPackageGenerator(_baseFixture.MockConfiguration); List <ShipmentPackageDTO> packages = shipmentPackageGenerator.GenerateRandomShipmentPackages(); Assert.True(packages.All(p => p.PackageWeightInKilos >= 10 && p.PackageWeightInKilos <= 25)); }
public void CheckIfPackageCountIsBetweenFiftyAndEighty() { ShipmentPackageGenerator shipmentPackageGenerator = new ShipmentPackageGenerator(_baseFixture.MockConfiguration); List <ShipmentPackageDTO> packages = shipmentPackageGenerator.GenerateRandomShipmentPackages(); Assert.True(packages.Count >= 50 && packages.Count <= 80); }
public void CheckIfPackageNumbersAreMinimumEightDigits() { ShipmentPackageGenerator shipmentPackageGenerator = new ShipmentPackageGenerator(_baseFixture.MockConfiguration); List <ShipmentPackageDTO> packages = shipmentPackageGenerator.GenerateRandomShipmentPackages(); IEnumerable <string> packageNumbers = packages.Select(p => p.PackageNumber); Assert.True(packageNumbers.All(p => p.Length >= 8)); }
public void CheckIfPackageNumbersAreNullOrEmpty() { ShipmentPackageGenerator shipmentPackageGenerator = new ShipmentPackageGenerator(_baseFixture.MockConfiguration); List <ShipmentPackageDTO> packages = shipmentPackageGenerator.GenerateRandomShipmentPackages(); IEnumerable <string> packageNumbers = packages.Select(p => p.PackageNumber); Assert.DoesNotContain(packageNumbers, p => string.IsNullOrEmpty(p)); }
public void CheckIfAddressNumbersAreTwoDigits() { ShipmentPackageGenerator shipmentPackageGenerator = new ShipmentPackageGenerator(_baseFixture.MockConfiguration); List <ShipmentPackageDTO> packages = shipmentPackageGenerator.GenerateRandomShipmentPackages(); IEnumerable <string> packageAddressNumbers = packages.Select(p => p.DeliveryAddressNumber); Assert.True(packageAddressNumbers.All(p => p.Length == 2)); }
public void CheckIfLastDeliverablePackagesDeliveryTimeIsBeforeWorkingHoursEnd() { ShipmentPackageGenerator shipmentPackageGenerator = new ShipmentPackageGenerator(_baseFixture.MockConfiguration); List <ShipmentPackageDTO> packages = shipmentPackageGenerator.GenerateRandomShipmentPackages(); ShipmentPackageDTO lastDeliverablePackage = packages.Last(p => p.ApproximateDeliveryTime.HasValue); int workingHourEndHour, workingHourEndMinute; int.TryParse(_baseFixture.MockConfiguration.GetSection("AppSettings")["WorkingHourEndHour"], out workingHourEndHour); int.TryParse(_baseFixture.MockConfiguration.GetSection("AppSettings")["WorkingHourEndMinute"], out workingHourEndMinute); var endWorkingTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, workingHourEndHour, workingHourEndMinute, 0); Assert.True(lastDeliverablePackage.ApproximateDeliveryTime < endWorkingTime); }