public void ensureAddingDuplicateRestrictionThrowsException()
        {
            Product         p    = new Product("#666", "der alte würfelt nicht", "product666.glb", PREDEFEFINED_CATEGORY, PREDEFINED_MATERIALS, PREDEFINED_MEASUREMENTS);
            ProductMaterial pm   = new ProductMaterial(p, PREDEFINED_MATERIAL2);
            Restriction     rest = new Restriction("restriction", new SameMaterialAndFinishAlgorithm());

            pm.addRestriction(rest);

            Action addDuplicateRestrictionAction = () => pm.addRestriction(rest);

            Assert.Throws <ArgumentException>(addDuplicateRestrictionAction);
        }
        public void ensureAddRestrictionThrowsExceptionIfRestrictionIsNull()
        {
            Product         p  = new Product("#666", "der alte würfelt nicht", "product666.glb", PREDEFEFINED_CATEGORY, PREDEFINED_MATERIALS, PREDEFINED_MEASUREMENTS);
            ProductMaterial pm = new ProductMaterial(p, PREDEFINED_MATERIAL2);
            Action          addNullRestrictionAction = () => pm.addRestriction(null);

            Assert.Throws <ArgumentException>(addNullRestrictionAction);
        }
        public void ensureHasRestrictionReturnsTrueIfRestrictionWasAdded()
        {
            Product         p    = new Product("#666", "der alte würfelt nicht", "product666.glb", PREDEFEFINED_CATEGORY, PREDEFINED_MATERIALS, PREDEFINED_MEASUREMENTS);
            ProductMaterial pm   = new ProductMaterial(p, PREDEFINED_MATERIAL2);
            Restriction     rest = new Restriction("restriction", new SameMaterialAndFinishAlgorithm());

            pm.addRestriction(rest);
            Assert.True(pm.hasRestriction(rest));
        }
        public void ensureAddRestrictionSucceeds()
        {
            Product         p    = new Product("#666", "der alte würfelt nicht", "product666.glb", PREDEFEFINED_CATEGORY, PREDEFINED_MATERIALS, PREDEFINED_MEASUREMENTS);
            ProductMaterial pm   = new ProductMaterial(p, PREDEFINED_MATERIAL2);
            Restriction     rest = new Restriction("restriction", new SameMaterialAndFinishAlgorithm());

            Action addValidRestrictionAction = () => pm.addRestriction(rest);

            Exception exception = Record.Exception(addValidRestrictionAction);

            Assert.Null(exception);
            Assert.True(pm.hasRestriction(rest));
        }
        public void ensureRemovePreviouslyAddedRestrictionDoesNotThrowException()
        {
            Product         p    = new Product("#666", "der alte würfelt nicht", "product666.glb", PREDEFEFINED_CATEGORY, PREDEFINED_MATERIALS, PREDEFINED_MEASUREMENTS);
            ProductMaterial pm   = new ProductMaterial(p, PREDEFINED_MATERIAL2);
            Restriction     rest = new Restriction("restriction", new SameMaterialAndFinishAlgorithm());

            pm.addRestriction(rest);

            Action removeValidRestrictionAction = () => pm.removeRestriction(rest);

            Exception exception = Record.Exception(removeValidRestrictionAction);

            Assert.Null(exception);
        }