예제 #1
0
        public void ensureSameWidthsProducesSameToString()
        {
            ProductSlotWidths slotWidths    = ProductSlotWidths.valueOf(4, 14, 8);
            ProductSlotWidths otherInstance = ProductSlotWidths.valueOf(4, 14, 8);

            Assert.Equal(slotWidths.ToString(), otherInstance.ToString());
        }
예제 #2
0
        public void ensureSameWidthsProducesSameHashCode()
        {
            ProductSlotWidths slotWidths    = ProductSlotWidths.valueOf(4, 14, 8);
            ProductSlotWidths otherInstance = ProductSlotWidths.valueOf(4, 14, 8);

            Assert.Equal(slotWidths.GetHashCode(), otherInstance.GetHashCode());
        }
예제 #3
0
        public void ensureSameWidthsInstanceIsEqual()
        {
            ProductSlotWidths slotWidths    = ProductSlotWidths.valueOf(3, 14, 8);
            ProductSlotWidths otherInstance = ProductSlotWidths.valueOf(3, 14, 8);

            Assert.Equal(slotWidths, otherInstance);
        }
예제 #4
0
        public void ensureDifferentRecommendedWidthProducesDifferenceHashCode()
        {
            ProductSlotWidths slotWidths    = ProductSlotWidths.valueOf(4, 14, 8);
            ProductSlotWidths otherInstance = ProductSlotWidths.valueOf(4, 16, 10);

            Assert.NotEqual(slotWidths.GetHashCode(), otherInstance.GetHashCode());
        }
예제 #5
0
        public void ensureDifferentTypeObjectIsNotEqual()
        {
            ProductSlotWidths    slotWidths           = ProductSlotWidths.valueOf(3, 14, 8);
            CustomizedDimensions customizedDimensions = CustomizedDimensions.valueOf(3, 14, 8);

            Assert.False(slotWidths.Equals(customizedDimensions));
        }
예제 #6
0
        public void ensureDifferentRecommendedWidthInstanceIsNotEqual()
        {
            ProductSlotWidths slotWidths    = ProductSlotWidths.valueOf(3, 14, 8);
            ProductSlotWidths otherInstance = ProductSlotWidths.valueOf(3, 14, 9);

            Assert.NotEqual(slotWidths, otherInstance);
        }
예제 #7
0
        public void ensureApplyAllRestrictionsReturnsNullIfProductDoesNotObeyRestrictions()
        {
            ProductCategory cat = new ProductCategory("All Products");

            Color        black  = Color.valueOf("Deep Black", 0, 0, 0, 0);
            Color        white  = Color.valueOf("Blinding White", 255, 255, 255, 0);
            List <Color> colors = new List <Color>()
            {
                black, white
            };

            Finish        glossy   = Finish.valueOf("Glossy", 100);
            Finish        matte    = Finish.valueOf("Matte", 0);
            List <Finish> finishes = new List <Finish>()
            {
                glossy, matte
            };

            Material material  = new Material("#001", "Really Expensive Wood", "ola.jpg", colors, finishes);
            Material material2 = new Material("#002", "Expensive Wood", "ola.jpg", colors, finishes);

            Dimension heightDimension = new SingleValueDimension(50);
            Dimension widthDimension  = new DiscreteDimensionInterval(new List <double>()
            {
                60, 65, 70, 80, 90, 105
            });
            Dimension depthDimension = new ContinuousDimensionInterval(10, 25, 5);

            Measurement measurement = new Measurement(heightDimension, widthDimension, depthDimension);

            Product product = new Product("Test", "Shelf", "shelf.glb", cat, new List <Material>()
            {
                material, material2
            }, new List <Measurement>()
            {
                measurement
            }, ProductSlotWidths.valueOf(4, 4, 4));
            Product product2 = new Product("Test", "Shelf", "shelf.glb", cat, new List <Material>()
            {
                material
            }, new List <Measurement>()
            {
                measurement
            }, ProductSlotWidths.valueOf(4, 4, 4));

            CustomizedDimensions customDimension   = CustomizedDimensions.valueOf(50, 80, 25);
            CustomizedMaterial   customMaterial    = CustomizedMaterial.valueOf(material2, white, matte);
            CustomizedProduct    customizedProduct = CustomizedProductBuilder.createCustomizedProduct("reference", product, customDimension).build();

            customizedProduct.changeCustomizedMaterial(customMaterial);

            customizedProduct.finalizeCustomization();
            RestrictableImpl instance = new RestrictableImpl();

            instance.addRestriction(new Restriction("same material", new SameMaterialAndFinishAlgorithm()));
            Assert.Null(instance.applyAllRestrictions(customizedProduct, product2));
        }
        public void ensureFromEntityWithEmptyUnitUsesMinimumUnit()
        {
            double minWidth         = 25;
            double maxWidth         = 50;
            double recommendedWidth = 35;

            ProductSlotWidths slotWidths = ProductSlotWidths.valueOf(minWidth, maxWidth, recommendedWidth);

            GetProductSlotWidthsModelView result = ProductSlotWidthsModelViewService.fromEntity(slotWidths, "");

            string expectedUnit = MeasurementUnitService.getMinimumUnit();

            Assert.Equal(expectedUnit, result.unit);
        }
예제 #9
0
        /// <summary>
        /// Converts an instance of AddProductSlotWidthsModelView into an instance of ProductSlotWidths.
        /// </summary>
        /// <param name="modelView">Instance of AddProductSlotWidthsModelView.</param>
        /// <returns>The created instance of ProductSlotWidths.</returns>
        /// <exception cref="System.ArgumentNullException">Thrown when the provided instance of AddProductSlotWidthsModelView is null.</exception>
        public static ProductSlotWidths fromModelView(AddProductSlotWidthsModelView modelView)
        {
            if (modelView == null)
            {
                throw new ArgumentNullException(ERROR_NULL_MODEL_VIEW);
            }

            double minWidth = MeasurementUnitService.convertFromUnit(modelView.minWidth, modelView.unit);

            double maxWidth = MeasurementUnitService.convertFromUnit(modelView.maxWidth, modelView.unit);

            double recommendedWidth = MeasurementUnitService.convertFromUnit(modelView.recommendedWidth, modelView.unit);

            return(ProductSlotWidths.valueOf(minWidth, maxWidth, recommendedWidth));
        }
예제 #10
0
        public void ensureNullCustomizedProductCollectionIsInvalid()
        {
            //Creates measurements and a material for the product
            List <Measurement> measurements = new List <Measurement>()
            {
                new Measurement(new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }),
                                new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }), new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }))
            };

            //Creates colors and finishes for the product's material list and customized product's customized material
            Color        color  = Color.valueOf("Blue", 1, 2, 3, 0);
            List <Color> colors = new List <Color>()
            {
                color
            };

            Finish        finish   = Finish.valueOf("Super shiny", 90);
            List <Finish> finishes = new List <Finish>()
            {
                finish
            };

            Material material = new Material("123", "456, how original", "ola.jpg", colors, finishes);

            //Creates a product for the customized product collection's customized product
            Product product = new Product("0L4", "H4H4", "goodmeme.glb", new ProductCategory("Drawers"), new List <Material>()
            {
                material
            }, measurements, ProductSlotWidths.valueOf(1, 5, 4));

            Assert.Throws <ArgumentException>(() => new CollectionProduct(null,
                                                                          CustomizedProductBuilder.createCustomizedProduct("reference", product,
                                                                                                                           CustomizedDimensions.valueOf(500.0, 500.0, 500.0))
                                                                          .withMaterial(CustomizedMaterial.valueOf(material, color, finish)).build()));
        }
        public void ensureFromEntityCreatesModelViewWithExpectedData()
        {
            double minWidth         = 25;
            double maxWidth         = 50;
            double recommendedWidth = 35;

            ProductSlotWidths slotWidths = ProductSlotWidths.valueOf(minWidth, maxWidth, recommendedWidth);

            GetProductSlotWidthsModelView result = ProductSlotWidthsModelViewService.fromEntity(slotWidths);

            GetProductSlotWidthsModelView expected = new GetProductSlotWidthsModelView();

            expected.minWidth         = minWidth;
            expected.maxWidth         = maxWidth;
            expected.recommendedWidth = recommendedWidth;
            expected.unit             = MeasurementUnitService.getMinimumUnit();

            Assert.Equal(expected.minWidth, result.minWidth);
            Assert.Equal(expected.maxWidth, result.maxWidth);
            Assert.Equal(expected.recommendedWidth, result.recommendedWidth);
            Assert.Equal(expected.unit, result.unit);
        }
예제 #12
0
        public void ensureApplyAllRestrictionsReturnsNullIfCustomizedProductArgumentNull()
        {
            ProductCategory cat = new ProductCategory("All Products");

            Color        black  = Color.valueOf("Deep Black", 0, 0, 0, 0);
            Color        white  = Color.valueOf("Blinding White", 255, 255, 255, 0);
            List <Color> colors = new List <Color>()
            {
                black, white
            };

            Finish        glossy   = Finish.valueOf("Glossy", 100);
            Finish        matte    = Finish.valueOf("Matte", 0);
            List <Finish> finishes = new List <Finish>()
            {
                glossy, matte
            };

            Material material = new Material("#001", "Really Expensive Wood", "ola.jpg", colors, finishes);

            Dimension heightDimension = new SingleValueDimension(50);
            Dimension widthDimension  = new DiscreteDimensionInterval(new List <double>()
            {
                60, 65, 70, 80, 90, 105
            });
            Dimension depthDimension = new ContinuousDimensionInterval(10, 25, 5);

            Measurement measurement = new Measurement(heightDimension, widthDimension, depthDimension);

            Product product = new Product("Test", "Shelf", "shelf.glb", cat, new List <Material>()
            {
                material
            }, new List <Measurement>()
            {
                measurement
            }, ProductSlotWidths.valueOf(4, 4, 4));

            Assert.Null(new RestrictableImpl().applyAllRestrictions(null, product));
        }
예제 #13
0
        private Product buildProduct()
        {
            List <Material> materials = new List <Material>()
            {
                buildMaterial()
            };

            Dimension   height      = new ContinuousDimensionInterval(40, 300, 1);
            Dimension   width       = new ContinuousDimensionInterval(40, 300, 1);
            Dimension   depth       = new ContinuousDimensionInterval(40, 320, 1);
            Measurement measurement = new Measurement(height, width, depth);

            List <Measurement> measurements = new List <Measurement>()
            {
                measurement
            };

            ProductSlotWidths productSlotWidths = ProductSlotWidths.valueOf(20, 50, 30);

            Product product = new Product("001", "This Is a Product", "model.obj", buildCategory(), materials, measurements, productSlotWidths);

            return(product);
        }
예제 #14
0
        private Product buildValidProduct()
        {
            Dimension firstHeightDimension = new ContinuousDimensionInterval(50, 100, 2);
            Dimension firstWidthDimension  = new DiscreteDimensionInterval(new List <double>()
            {
                75, 80, 85, 90, 95, 120
            });
            Dimension firstDepthDimension = new SingleValueDimension(25);

            Measurement firstMeasurement = new Measurement(firstHeightDimension, firstWidthDimension, firstDepthDimension);

            Dimension   sideDimension     = new SingleValueDimension(60);
            Measurement secondMeasurement = new Measurement(sideDimension, sideDimension, sideDimension);

            ProductSlotWidths slotWidths = ProductSlotWidths.valueOf(25, 50, 35);

            return(new Product("#429", "Fabulous Closet", "fabcloset.glb", buildValidCategory(), new List <Material>()
            {
                buildValidMaterial()
            }, new List <Measurement>()
            {
                firstMeasurement, secondMeasurement
            }, slotWidths));
        }
        public void ensureFromEntityWithUnitConvertsValues()
        {
            double minWidth         = 25;
            double maxWidth         = 50;
            double recommendedWidth = 35;

            ProductSlotWidths slotWidths = ProductSlotWidths.valueOf(minWidth, maxWidth, recommendedWidth);

            string unit = "dm";

            GetProductSlotWidthsModelView result = ProductSlotWidthsModelViewService.fromEntity(slotWidths, unit);

            GetProductSlotWidthsModelView expected = new GetProductSlotWidthsModelView();

            expected.minWidth         = MeasurementUnitService.convertToUnit(minWidth, unit);
            expected.maxWidth         = MeasurementUnitService.convertToUnit(maxWidth, unit);
            expected.recommendedWidth = MeasurementUnitService.convertToUnit(recommendedWidth, unit);
            expected.unit             = unit;

            Assert.Equal(expected.minWidth, result.minWidth);
            Assert.Equal(expected.maxWidth, result.maxWidth);
            Assert.Equal(expected.recommendedWidth, result.recommendedWidth);
            Assert.Equal(expected.unit, result.unit);
        }
예제 #16
0
        public void ensureProductSlotWidthsCantBeCreatedIfMaxWidthIsPositiveInfinity()
        {
            Action positiveInfinityMaxSlotWidth = () => ProductSlotWidths.valueOf(9, double.PositiveInfinity, 15);

            Assert.Throws <ArgumentException>(positiveInfinityMaxSlotWidth);
        }
예제 #17
0
        public void ensureProductSlotWidthsIsCreated()
        {
            ProductSlotWidths slotWidths = ProductSlotWidths.valueOf(3, 14, 8);

            Assert.NotNull(slotWidths);
        }
예제 #18
0
        public void ensureSameInstanceIsEqual()
        {
            ProductSlotWidths slotWidths = ProductSlotWidths.valueOf(3, 14, 8);

            Assert.True(slotWidths.Equals(slotWidths));
        }
예제 #19
0
        public void ensureNullObjectIsNotEqual()
        {
            ProductSlotWidths slotWidths = ProductSlotWidths.valueOf(3, 14, 8);

            Assert.False(slotWidths.Equals(null));
        }
예제 #20
0
        public void ensureProductSlotWidthsCantBeCreatedIfRecommendedWidthIsPositiveInfinity()
        {
            Action positiveInfinityRecSlotWidth = () => ProductSlotWidths.valueOf(9, 21, double.PositiveInfinity);

            Assert.Throws <ArgumentException>(positiveInfinityRecSlotWidth);
        }
예제 #21
0
        public void ensureProductSlotWidthsCantBeCreatedIfMinWidthIsNaN()
        {
            Action nanMinSlotWidth = () => ProductSlotWidths.valueOf(double.NaN, 21, 15);

            Assert.Throws <ArgumentException>(nanMinSlotWidth);
        }
예제 #22
0
        public void ensureProductSlotWidthsCantBeCreatedIfMinWidthIsNegativeInfinity()
        {
            Action negativeInfinityMinSlotWidth = () => ProductSlotWidths.valueOf(double.NegativeInfinity, 21, 15);

            Assert.Throws <ArgumentException>(negativeInfinityMinSlotWidth);
        }
예제 #23
0
        public void testToDTO()
        {
            //Creates measurements and a material for the product
            List <Measurement> measurements = new List <Measurement>()
            {
                new Measurement(new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }),
                                new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }), new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }))
            };

            //Creates colors and finishes for the product's material list
            List <Color> colors = new List <Color>()
            {
                Color.valueOf("Blue", 1, 2, 3, 0)
            };
            List <Finish> finishes = new List <Finish>()
            {
                Finish.valueOf("Super shiny", 40)
            };
            //Creates a material list
            List <Material> materials = new List <Material>()
            {
                new Material("123", "456, how original", "ola.jpg", colors, finishes)
            };


            //Creates a parent product
            Product parent = new Product("Kinda bad", "Anakin", "kindabad.glb", new ProductCategory("Drawers"), materials, measurements, ProductSlotWidths.valueOf(1, 5, 4));

            //Creates a child product
            Product child = new Product("Not so bad", "Luke", "notsobad.glb", new ProductCategory("Drawers"), materials, measurements, ProductSlotWidths.valueOf(1, 5, 4));

            Component component = new Component(parent, child);

            ComponentDTO expected = new ComponentDTO();

            expected.product = child.toDTO();

            ComponentDTO actual = component.toDTO();

            Assert.Equal(expected.product.complements, actual.product.complements);
            Assert.Equal(expected.product.designation, actual.product.designation);
            Assert.Equal(expected.product.dimensions.Capacity, actual.product.dimensions.Capacity);
            Assert.Equal(expected.product.productCategory.name, actual.product.productCategory.name);
            Assert.Equal(expected.product.productMaterials.Count, actual.product.productMaterials.Count);
            Assert.Equal(expected.product.productMaterials.Capacity, actual.product.productMaterials.Capacity);
            Assert.Equal(expected.product.reference, actual.product.reference);
            Assert.Equal(expected.product.id, actual.product.id);
        }
예제 #24
0
        public void ensureCreationIsSuccessfulWithValidRestrictionListAValidProductAndAMandatoryOption()
        {
            //Creates measurements and a material for the product
            List <Measurement> measurements = new List <Measurement>()
            {
                new Measurement(new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }),
                                new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }), new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }))
            };

            //Creates colors and finishes for the product's material list
            List <Color> colors = new List <Color>()
            {
                Color.valueOf("Blue", 1, 2, 3, 0)
            };
            List <Finish> finishes = new List <Finish>()
            {
                Finish.valueOf("Super shiny", 40)
            };
            //Creates a material list
            List <Material> materials = new List <Material>()
            {
                new Material("123", "456, how original", "ola.jpg", colors, finishes)
            };

            //Creates a parent product
            Product parent = new Product("Kinda bad", "Anakin", "kindabad.glb", new ProductCategory("Drawers"), materials, measurements, ProductSlotWidths.valueOf(1, 5, 4));

            //Creates a child product
            Product child = new Product("Not so bad", "Luke", "notsobad.glb", new ProductCategory("Drawers"), materials, measurements, ProductSlotWidths.valueOf(1, 5, 4));

            Assert.NotNull(new Component(parent, child, new List <Restriction>()
            {
                new Restriction("POIS", new SameMaterialAndFinishAlgorithm())
            }, true));
        }
예제 #25
0
        public void ensureApplyAllRestrictionsReturnsRestrictedProduct()
        {
            ProductCategory cat = new ProductCategory("All Products");

            Color        black  = Color.valueOf("Deep Black", 0, 0, 0, 0);
            Color        white  = Color.valueOf("Blinding White", 255, 255, 255, 0);
            List <Color> colors = new List <Color>()
            {
                black, white
            };

            Finish        glossy   = Finish.valueOf("Glossy", 100);
            Finish        matte    = Finish.valueOf("Matte", 0);
            List <Finish> finishes = new List <Finish>()
            {
                glossy, matte
            };

            Material material  = new Material("#001", "Really Expensive Wood", "ola.jpg", colors, finishes);
            Material material2 = new Material("#002", "Expensive Wood", "ola.jpg", colors, finishes);

            Dimension heightDimension = new SingleValueDimension(50);
            Dimension widthDimension  = new DiscreteDimensionInterval(new List <double>()
            {
                60, 65, 70, 80, 90, 105
            });
            Dimension depthDimension = new ContinuousDimensionInterval(10, 25, 5);

            Measurement measurement = new Measurement(heightDimension, widthDimension, depthDimension);

            Product product = new Product("Test", "Shelf", "shelf.glb", cat, new List <Material>()
            {
                material, material2
            }, new List <Measurement>()
            {
                measurement
            }, ProductSlotWidths.valueOf(4, 4, 4));
            Product product2 = new Product("Test", "Shelf", "shelf.glb", cat, new List <Material>()
            {
                material, material2
            }, new List <Measurement>()
            {
                measurement
            }, ProductSlotWidths.valueOf(4, 4, 4));

            CustomizedDimensions customDimension   = CustomizedDimensions.valueOf(50, 80, 25);
            CustomizedMaterial   customMaterial    = CustomizedMaterial.valueOf(material, white, matte);
            CustomizedProduct    customizedProduct = CustomizedProductBuilder.createCustomizedProduct("reference", product, customDimension).build();

            customizedProduct.changeCustomizedMaterial(customMaterial);

            customizedProduct.finalizeCustomization();
            RestrictableImpl instance = new RestrictableImpl();

            instance.addRestriction(new Restriction("same material", new SameMaterialAndFinishAlgorithm()));

            WidthPercentageAlgorithm algorithm = new WidthPercentageAlgorithm();
            Input minInput = Input.valueOf("Minimum Percentage", "From 0 to 1");
            Input maxInput = Input.valueOf("Maximum Percentage", "From 0 to 1");
            Dictionary <Input, string> inputs = new Dictionary <Input, string>();

            inputs.Add(minInput, "0.8");
            inputs.Add(maxInput, "1.0");
            algorithm.setInputValues(inputs);
            instance.addRestriction(new Restriction("width percentage", algorithm));

            Product returned = instance.applyAllRestrictions(customizedProduct, product2);

            Assert.True(returned.productMaterials.Count == 1);
            Assert.True(returned.productMaterials[0].material.Equals(material));
            Assert.True(returned.productMeasurements[0].measurement.width.getMinValue() == 65);
            Assert.True(returned.productMeasurements[0].measurement.width.getMaxValue() == 80);
        }
예제 #26
0
        public void ensureProductSlotWidthsCantBeCreatedIfMaxWidthIsNegative()
        {
            Action negativeMaxSlotWidth = () => ProductSlotWidths.valueOf(9, -1, 15);

            Assert.Throws <ArgumentException>(negativeMaxSlotWidth);
        }
예제 #27
0
        public void ensureValidRestrictionCanBeAddedToTheComponentsRestrictionsList()
        {
            //Creates measurements and a material for the product
            List <Measurement> measurements = new List <Measurement>()
            {
                new Measurement(new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }),
                                new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }), new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }))
            };

            //Creates colors and finishes for the product's material list
            List <Color> colors = new List <Color>()
            {
                Color.valueOf("Blue", 1, 2, 3, 0)
            };
            List <Finish> finishes = new List <Finish>()
            {
                Finish.valueOf("Super shiny", 40)
            };
            //Creates a material list
            List <Material> materials = new List <Material>()
            {
                new Material("123", "456, how original", "ola.jpg", colors, finishes)
            };

            //Creates a parent product
            Product parent = new Product("Kinda bad", "Anakin", "kindabad.glb", new ProductCategory("Drawers"), materials, measurements, ProductSlotWidths.valueOf(1, 5, 4));

            //Creates a child product
            Product child = new Product("Not so bad", "Luke", "notsobad.glb", new ProductCategory("Drawers"), materials, measurements, ProductSlotWidths.valueOf(1, 5, 4));

            Component component = new Component(parent, child, new List <Restriction>()
            {
                new Restriction("FUNCIONE", new SameMaterialAndFinishAlgorithm())
            });

            Action addRestrictionAction = () => component.addRestriction(new Restriction("FUNCIONOU", new SameMaterialAndFinishAlgorithm()));

            Exception exception = Record.Exception(addRestrictionAction);

            Assert.Null(exception);
        }
예제 #28
0
        public void ensureProductSlotWidthsCantBeCreatedIfMaxWidthIsZero()
        {
            Action zeroMaxSlotWidth = () => ProductSlotWidths.valueOf(9, 0, 15);

            Assert.Throws <ArgumentException>(zeroMaxSlotWidth);
        }
예제 #29
0
        public void ensureNullChildProductIsNotValid()
        {
            //Creates measurements and a material for the product
            List <Measurement> measurements = new List <Measurement>()
            {
                new Measurement(new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }),
                                new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }), new DiscreteDimensionInterval(new List <Double>()
                {
                    500.0
                }))
            };

            //Creates colors and finishes for the product's material list
            List <Color> colors = new List <Color>()
            {
                Color.valueOf("Blue", 1, 2, 3, 0)
            };
            List <Finish> finishes = new List <Finish>()
            {
                Finish.valueOf("Super shiny", 40)
            };
            //Creates a material list
            List <Material> materials = new List <Material>()
            {
                new Material("123", "456, how original", "ola.jpg", colors, finishes)
            };

            //Creates a parent product
            Product parent = new Product("Kinda bad", "Anakin", "kindabad.glb", new ProductCategory("Drawers"), materials, measurements, ProductSlotWidths.valueOf(1, 5, 4));

            Assert.Throws <ArgumentException>(() => new Component(parent, null));
            Assert.Throws <ArgumentException>(() => new Component(parent, null, true));
            Assert.Throws <ArgumentException>(() => new Component(parent, null, new List <Restriction>()
            {
                new Restriction("ISTO É", new SameMaterialAndFinishAlgorithm())
            }));
            Assert.Throws <ArgumentException>(() => new Component(parent, null, new List <Restriction>()
            {
                new Restriction("ISTO É", new SameMaterialAndFinishAlgorithm())
            }, true));
        }
예제 #30
0
        public void ensureProductSlotWidthsCantBeCreatedIfRecommendedWidthIsNaN()
        {
            Action nanRecSlotWidth = () => ProductSlotWidths.valueOf(9, 21, double.NaN);

            Assert.Throws <ArgumentException>(nanRecSlotWidth);
        }