예제 #1
0
        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());
        }
예제 #2
0
        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());
        }
예제 #3
0
        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));
        }
예제 #4
0
        public void CheckIfPackageCountIsBetweenFiftyAndEighty()
        {
            ShipmentPackageGenerator  shipmentPackageGenerator = new ShipmentPackageGenerator(_baseFixture.MockConfiguration);
            List <ShipmentPackageDTO> packages = shipmentPackageGenerator.GenerateRandomShipmentPackages();

            Assert.True(packages.Count >= 50 && packages.Count <= 80);
        }
예제 #5
0
        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));
        }
예제 #6
0
        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));
        }
예제 #7
0
        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));
        }
예제 #8
0
        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);
        }